Page 1 of 1

Using the negate plugin

Posted: Tue Sep 18, 2012 10:49 am
by sal@coned
I am starting a new thread on this because the Subject no longer applies.

I am monitoring a network interface that is normally down, I need to be alerted when the interface goes UP.
I was pointed to the negate plugin which sounds like it would do exactly what I need, except it does not seem to work with the check_ping_interface plugin.
If the HOST is up and reachable the negate plugin reverses the result properly it changes the result from OK to CRITICAL, however if the HOST is unreachable the negate plugin fails.

Command line
./negate -t 30 -s -c OK -o CRITICAL /usr/local/nagios/libexec/check_ping -H 172.28.31.26 -w 3000.0,80% -c 5000.0,100% -p 5
Result when HOST is up and reachable
PING CRITICAL - Packet loss = 0%, RTA = 0.45 ms|rta=0.446000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0
Result when the HOST is DOWN
CRITICAL - Plugin timed out after 30 seconds
.
I have used several time out values and get the same result.

If I test against a service as shown in the help document the negate plugin works properly.
Is this a bug or am I not using it properly.

Thanks
Sal

Re: Using the negate plugin

Posted: Tue Sep 18, 2012 12:26 pm
by lmiltchev
I believe the issue is in the timeout of the check_ping. Try using one the the following two commands and see if this is going to solve your issue:

./negate -t 35 -s -c OK -o CRITICAL /usr/local/nagios/libexec/check_ping -H 172.28.31.26 -w 3000.0,80% -c 5000.0,100% -p 5

or

./negate -t 30 -s -c OK -o CRITICAL /usr/local/nagios/libexec/check_ping -H 172.28.31.26 -t 20 -w 3000.0,80% -c 5000.0,100% -p 5

Re: Using the negate plugin

Posted: Wed Sep 19, 2012 10:19 am
by sal@coned
Thaks for the reply, I looked into the timeout values.

I did some further testing and found the check_ping plugin does not seem to use the timeout variable, the plugin sending 4 ping requests executes for 24 seconds even though the timeout changed from 1 to 5.

The only way I was able to reduce the amount of time was to reduce the number of ping requests using the -p variable.

I tested by changing the timieout variable and recording the responce time using the following script,

Code: Select all

echo " ***  Change timeout *** "
echo
echo "/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 1"
date
/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 1
date
echo
echo "/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 2"
date
/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 2
date
echo
echo "/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 3"
date
/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 3
date
echo
echo "/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 4"
date
/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 4
date
echo
echo "/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 5"
date
/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 5
and got these results
*** Change timeout ***

/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 1
Wed Sep 19 11:06:20 EDT 2012
PING CRITICAL - Packet loss = 100%|rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0
Wed Sep 19 11:06:44 EDT 2012

/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 2
Wed Sep 19 11:06:44 EDT 2012
PING CRITICAL - Packet loss = 100%|rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0
Wed Sep 19 11:07:08 EDT 2012

/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 3
Wed Sep 19 11:07:08 EDT 2012
PING CRITICAL - Packet loss = 100%|rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0
Wed Sep 19 11:07:32 EDT 2012

/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 4
Wed Sep 19 11:07:32 EDT 2012
PING CRITICAL - Packet loss = 100%|rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0
Wed Sep 19 11:07:56 EDT 2012

/usr/local/nagios/libexec/check_ping -H 172.28.51.26 -w 3000.0,80% -c 5000.0,100% -p 4 -t 5
Wed Sep 19 11:07:56 EDT 2012
PING CRITICAL - Packet loss = 100%|rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0
Wed Sep 19 11:08:20 EDT 2012

Re: Using the negate plugin

Posted: Wed Sep 19, 2012 11:25 am
by scottwilkerson
as long as the timeout we specify in the ./negate command is longer than the check_ping you should be able to accomplish your goal