Using the negate plugin

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

Using the negate plugin

Post 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
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Using the negate plugin

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
sal@coned
Posts: 72
Joined: Thu Jan 21, 2010 4:42 pm

Re: Using the negate plugin

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using the negate plugin

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked