Re: ORing hosts in a hostgroup (instead of ANDing) for a monitor

2005-03-26 Thread Ed Ravin
On Fri, Mar 25, 2005 at 10:57:26PM -0300, Raul Dias wrote:
 Is it possible to have an monitor to OR the hosts in a hostgroup and if
 one SUCCEED the service is considered SUCCESS?
 
 An example for this is to have a hostgroup with a few internet hosts
 and fping them.  If one of them succeeds then the internet conection is
 ok.  Some may fail and the conection still be ok. 
 
 However if all of them fails, then the internet conection is supposed to
 be considered down.

Yes, you can do this, but you'll need to code it yourself in the monitor
script.  At the beginning of the script, get a count of the hosts being
polled, then at the end of the script, count the failures - if you still
have at least one host up, adjust the exit status appropriately.

You could also write this as a wrapper script that would invoke the
desired monitor script.  Your wrapper would need to know something
about the options syntax for the monitor script, but this could
be done generically by passing the options or a flag of some kind
(like --) to the wrapper.

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: ORing hosts in a hostgroup (instead of ANDing) for a monitor

2005-03-26 Thread David Nolan

--On Friday, March 25, 2005 10:57 PM -0300 Raul Dias [EMAIL PROTECTED] 
wrote:

Sorry if this is covered in the docs and I missed.
Is it possible to have an monitor to OR the hosts in a hostgroup and if
one SUCCEED the service is considered SUCCESS?
An example for this is to have a hostgroup with a few internet hosts
and fping them.  If one of them succeeds then the internet conection is
ok.  Some may fail and the conection still be ok.
However if all of them fails, then the internet conection is supposed to
be considered down.
Did I miss something?

Is this possible?  Yes.
It needs to be a feature of whatever monitor script you're using.
Are there any monitor scripts that do this now? Yes.
If you pass '-a' to fping.monitor it will report failure only if all hosts 
fail to respond.

Another approach is to add a threshold argument to the monitor script that 
causes it to allow that many hosts to be down before signaling an error.  I 
already have a modified version of fping.monitor that does essentially 
that, except it exits with different error codes depending upon the number 
of failures.  i.e. if I set the threshold to 1 then if more then one host 
fails to respond the script returns 255.  I suppose I could just commit 
those changes back to the main mon version, since they're entirely optional 
additional features, but for now that version is available at:
https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/netsage/mon/mon.d/fping.monitor?rev=1.9content-type=text/x-cvsweb-markup

-David
David Nolan*[EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
 a herd of rogue emacs fsck your troff and vgrind your pathalias!
___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


ORing hosts in a hostgroup (instead of ANDing) for a monitor

2005-03-25 Thread Raul Dias

Sorry if this is covered in the docs and I missed.

Is it possible to have an monitor to OR the hosts in a hostgroup and if
one SUCCEED the service is considered SUCCESS?

An example for this is to have a hostgroup with a few internet hosts
and fping them.  If one of them succeeds then the internet conection is
ok.  Some may fail and the conection still be ok. 

However if all of them fails, then the internet conection is supposed to
be considered down.

Did I miss something?


Regards,

Raul Dias


___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon