Service dependency question

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sal@coned
Posts: 72
Joined: Thu Jan 21, 2010 4:42 pm

Service dependency question

Post by sal@coned »

I have a host (Fortigate Firewall) with 2 internet connections, the secondary connection becames active only if the primary connecion goes down.
I want to be alerted when the secondary connection becomes active.
How do I keep the secondary service from being displayed as critical while its down, in this case down is the normal state and active would be the critical state.

I'm running NagiosXI V3.3


I created 2 services using check_icmp_interface and made the secondary service depedent on the primary connection as shown below.
Host:my_host_1
Host groups:<not defined>
Services:Host-icmp-primary

Dependent host:my_host_1
Dependent hostgroups:<not defined>
Dependent services: Host-icmp-secondary

Dependency period: 24X7
Active: yes
Inherit parents: no
Execute failure criteria: o
Notification failure criteria: o
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service dependency question

Post by scottwilkerson »

You could use the negate plugin to prefix the command for the secondary

Code: Select all

[root@localhost libexec]# ./negate -h
negate v1989 (nagios-plugins 1.4.13)
Copyright (c) 2002-2008 Nagios Plugin Development Team
        <[email protected]>

Negates the status of a plugin (returns OK for CRITICAL and vice-versa).
Additional switches can be used to control which state becomes what.


Usage:negate [-t timeout] [-owcu STATE] [-s] <definition of wrapped plugin>

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 11)
    Keep timeout longer than the plugin timeout to retain CRITICAL status.
 -o, --ok=STATUS
 -w, --warning=STATUS
 -c, --critical=STATUS
 -u, --unknown=STATUS
    STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without single
    quotes. Numeric values are accepted. If nothing is specified, permutes
    OK and CRITICAL.
 -s, --substitute
    Substitute output text as well. Will only substitute text in CAPITALS

Examples:
 negate /usr/local/nagios/libexec/check_ping -H host
    Run check_ping and invert result. Must use full path to plugin
 negate -w OK -c UNKNOWN /usr/local/nagios/libexec/check_procs -a 'vi negate.c'
    This will return OK instead of WARNING and UNKNOWN instead of CRITICAL

Notes:
 This plugin is a wrapper to take the output of another plugin and invert it.
 The full path of the plugin must be provided.
 If the wrapped plugin returns OK, the wrapper will return CRITICAL.
 If the wrapped plugin returns CRITICAL, the wrapper will return OK.
 Otherwise, the output state of the wrapped plugin is unchanged.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sal@coned
Posts: 72
Joined: Thu Jan 21, 2010 4:42 pm

Re: Service dependency question

Post by sal@coned »

I configured the command using the negate utility and it does not work when the normal condition is down.
I ran it from the command line at tested against a host that was up and then repeated the test against a host that was down and got a Plugin timed out error.

Output of tests:

Code: Select all

[B]test aginst reachable host[/B]
[root@nagios-hq-1 libexec]# ./negate -s /usr/local/nagios/libexec/check_icmp -H 172.28.31.26 -w 3000.0,80% -c 5000.0,100%
CRITICAL - 172.28.31.26: rta 10.915ms, lost 0%|rta=10.915ms;3000.000;5000.000;0; pl=0%;80;100;;

[B]test aginst down host[/B]
[root@nagios-hq-1 libexec]# ./negate -s /usr/local/nagios/libexec/check_icmp -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100%
CRITICAL - Plugin timed out after 10 seconds
sal@coned
Posts: 72
Joined: Thu Jan 21, 2010 4:42 pm

Re: Service dependency question

Post by sal@coned »

I got the negate to work with a few teaks (1) the time out had to be set to 30 and the -s argumens is required.
The funny thing is that it does not behave like this for the check services example.

Code: Select all

[root@nagios-hq-1 libexec]# ./negate -t 30 -s -c OK -o CRITICAL  /usr/local/nagios/libexec/check_icmp -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 5
OK - 172.28.51.26: rta nan, lost 100%|rta=0.000ms;3000.000;5000.000;0; pl=100%;80;100;;
Locked