monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monit and xmpp notifications


From: Dirk-Jan C. Binnema
Subject: Re: monit and xmpp notifications
Date: Thu, 2 Dec 2004 15:32:22 +0100
User-agent: Mutt/1.5.6+20040907i

On Wed, Dec 01, 2004 at 18:47 (+0100), Jan-Henrik Haukeland wrote:
> 
> On Dec 1, 2004, at 4:40 PM, Dirk-Jan C. Binnema wrote:
 >
> >      if c1 then exec "echo \"restarting bla\" | sendxmmp -s warning 
> >address@hidden"
> >      if c1 then restart
> >
> >This seems a bit funny, esp. as c1 may change between the two tests.
> 
> I'm not so worried about changes in c1 though but yeah it's funny in a 
> bad way.  It is true that only one statement is allowed after "then" 
> which is meaningful since the available statements don't mix easily.
> 
> BTW, you cannot use pipe in the exec statement, it's not a shell but a 
> plain exec(3). It's equal to the exec command you have in your shell. 
> In this particular case you could maybe write something like
>       exec "sendxmmp -s 'warning $MONIT_EVENT address@hidden'"

Ah - but sendxmpp expect it's input (the message body) either from stdin
or from a file (like mail(1)). So I need some wrapper script....

> >You mean loading external code into monit?
 
> To write your own protocol test function you must use a fixed signature 
> for the function which looks like this "int(*check)(Socket_T)".  What I 
> was proposing was to add a interface so you could write your own 
> alert-function. The function could take a general Message_T object 
> which it utilize to send the alert message over whatever protocol. I.e. 
> the signature would look something like this: int(*alert)(Message_T).

That would be nice indeed. Thinking about it, there's probably only a
handful of alerting systems you want to support, unlike the many, many
protocols.

But it would be nice too it there were a way to do that with simply
calling external programs - a more powerful 'exec'. I'd rather write my
protocol tests in perl than in C.

The same is true for the alerters -- I am sure writing, say, an
SMS-alerter, is a lot faster in perl (python, sh, ...) compared C.
 
> The bottom line is that you could then write in monit's control file 
> stuff like:
> 
>       set alert handler smtp and xmpp and snmp
> 
> so whenever monit issue an alert message it calls each of the defined 
> alert handlers with the same Message object. So if you write this in 
> monit's control file
> 
>       if foo then alert
> 
> monit will send a SMTP mail, call xmpp (whatever that is:) and emit a 
> snmp event message. It should also be possible to  specify a certain 
> alert handler in any if-test such as
> 
>       if foo then alert over snmp
> 
> or in your case
> 
>       if foo then alert xmpp [blablabla]
> 
> Anyway this is just an idea from the top of my head and I admit that I 
> haven't really thought it through..

Sounds good! Esp. if we could define alerters in terms of the
more-powerful exec and some external scripts.

Thanks,
Dirk.

-- 
/*
 * Dirk-Jan C. Binnema  [djcb]
 *   address@hidden
 * www.djcbsoftware.nl/ChangeLog
 *     address@hidden
 */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]