On Tue, 30 Oct 2007, Justin Pittman wrote:


How does mon do logic like OR?  I need to test for a service that can be on 
port X or Y but where a success on either is good ÿÿ

this is usually the responsibility of the monitor program itself. so, for
example, if the service is xyz.monitor and it took an argument "-p" so you
could tell it which port to check, then you'd need to make it do the test that
you want and decide what is a "success" for that service.

there is also the dependency mechanism, which may or may not do what you're
looking to do. fwiw,

watch thishost
    service service1
        monitor service1.monitor
        interval 1m
        period wd {Sun-Sat}
            alert mail.alert [EMAIL PROTECTED]
            depend not SELF:service2
    service service2
        monitor service2.monitor
        interval 1m
        period wd {Sun-Sat}
            alert mail.alert [EMAIL PROTECTED]
            depend not SELF:service1

the "depend" term belongs within a period definition. after a monitor exits,
the dependency expression for that service will be evaluated, and if the result
is "true" (numerically 1), that means that none of the parent dependencies have
indicated that there was a failure among them. if that is the case, then the
alert(s) in the period will be invoked under the normal rules.

if the evaluation is "false" (numerically 0), then that means the parent
dependencies are experiencing a failure, so suppress the alerts until the
parent dependencies stop indicating that there is a failure.

the dependency expression is just perl, so you may use any perl operators, such
as the binary "and", "or", "not", etc.  firstly, before the expression is
handed off to perl's "eval" construct, mon will look for terms in the
expression which match "group:service", which are meant to correspond to a
group and service from in the mon configuration, and it substitutes them with
the numerical value of the current operational status for that group and
service.

there is a global variable called "dep_behavior" which controls what a
dependency which evaluates to "true" will suppress. the default is to suppress
alerts, but you can set it to suppress running monitors as well.
_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to