negate no longer works after I update Centos 6

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tecnalb
Posts: 133
Joined: Tue May 03, 2011 12:53 pm

negate no longer works after I update Centos 6

Post by tecnalb »

Hello,

I was using the following command to let me know when a file system check was running. It was working, and when I initiated an fsck I would get an alert... until I upgraded to Centos 6.7 yesterday.

$USER1$/negate $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c check_services -a "e2fsck"


I manually ran this from the nagios server now, and it seems the negate command no longer functions.

[root@nagios libexec]# ./check_nrpe -H xxxx.xxx -t 30 -c check_services -a "e2fsck"
e2fsck: 1

[root@nagios libexec]# ./negate ./check_nrpe -H xxxx.xxx-a "e2fsck"
e2fsck: 1
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: negate no longer works after I update Centos 6

Post by jolson »

I would get an alert... until I upgraded to Centos 6.7 yesterday.
I assume you updated the Nagios XI box?

Lets check on the md5 of your negate plugin, as well as the permissions in question:

Code: Select all

cd /usr/local/nagios/libexec
ls -l negate
md5sum negate
Here is the output of my working box:
[root@localhost libexec]# ls -l negate
-rwxr-xr-x 1 root root 131574 Jul 29 16:58 negate
[root@localhost libexec]# md5sum negate
fc00d48fbe55c7a2670a6bb21475b09e negate
After you run the negate check, what is the exit status?

Code: Select all

./negate ./check_nrpe -H xxxx.xxx-a "e2fsck"

Code: Select all

echo $?
It's likely that the output of your check_nrpe plugin will remain consistent while negate will influence the exit status.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
tecnalb
Posts: 133
Joined: Tue May 03, 2011 12:53 pm

Re: negate no longer works after I update Centos 6

Post by tecnalb »

No, I updated the target host only. However it seems my negate and your negate are vastly different.

[root@nagios libexec]# ls -l negate
-rwxr-xr-x 1 root root 142110 Nov 23 2014 negate
[root@nagios libexec]# md5sum negate
45f489e6de337c821233634ecca98b67 negate
[root@nagios libexec]#
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: negate no longer works after I update Centos 6

Post by jolson »

Please run through the bottom part of my post:

After you run the negate check, what is the exit status?

Code: Select all

./negate ./check_nrpe -H xxxx.xxx-a "e2fsck"
echo $?
It's likely that the output of your check_nrpe plugin will remain consistent while negate will influence the exit status.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
tecnalb
Posts: 133
Joined: Tue May 03, 2011 12:53 pm

Re: negate no longer works after I update Centos 6

Post by tecnalb »

Code: Select all

./negate ./check_nrpe -H xxxx.xxx-a "e2fsck"

Code: Select all

echo $?
[root@nagios libexec]# ./negate ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
2


Without negate

[root@nagios libexec]# ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
0
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: negate no longer works after I update Centos 6

Post by jolson »

Based on that output, negate is working properly.
Without negate

[root@nagios libexec]# ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
0
Note that without negate, you get an exit status of '0' - meaning 'OK' in Nagios.
[root@nagios libexec]# ./negate ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
2
Note that with negate, you have an exit status of '2' - meaning 'CRITICAL' in Nagios.

If you set up your checks with the 'negate' command, they will alert you properly based on the results above.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
tecnalb
Posts: 133
Joined: Tue May 03, 2011 12:53 pm

Re: negate no longer works after I update Centos 6

Post by tecnalb »

tecnalb wrote:
jolson wrote:Based on that output, negate is working properly.
Without negate

[root@nagios libexec]# ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
0
Note that without negate, you get an exit status of '0' - meaning 'OK' in Nagios.
[root@nagios libexec]# ./negate ./check_nrpe -H xxx.xxx -a "e2fsck"
NRPE v2.14
[root@nagios libexec]# echo $?
2
Note that with negate, you have an exit status of '2' - meaning 'CRITICAL' in Nagios.

If you set up your checks with the 'negate' command, they will alert you properly based on the results above.

But esfsck is not running, and not in the process table, so why would it be a 0? It wasn't before. That was the purpose of the negate... to prevent a RED indication from displaying in Nagios unless e2fsck was in memory. If I did run a file system check, then I would get a red indication. In fact, I believe it might have been a support question or old threat here that put me down that path in the first place.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: negate no longer works after I update Centos 6

Post by Box293 »

Looking at this with a different set of eyes I can see we have asked you to do an incorrect command:
jolson wrote:Please run through the bottom part of my post:

After you run the negate check, what is the exit status?

Code: Select all

./negate ./check_nrpe -H xxxx.xxx -a "e2fsck"
echo $?
It's likely that the output of your check_nrpe plugin will remain consistent while negate will influence the exit status.
We've asked you to simply run check_nrpe against the host WITHOUT issuing a command using -c ... so that is why you are getting a response that includes the NRPE version.

So trying this instead please:

Code: Select all

./check_nrpe -H xxx.xxx -c check_services -a "e2fsck"

echo $?

./negate ./check_nrpe -H xxx.xxx -c check_services -a "e2fsck"

echo $?
Also, can you please run this on the remote host:

Code: Select all

/usr/local/nagios/libexec/check_services -p e2fsck

echo $?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tecnalb
Posts: 133
Joined: Tue May 03, 2011 12:53 pm

Re: negate no longer works after I update Centos 6

Post by tecnalb »

Good AM!

Here is my output...
[root@nagios libexec]# ./check_nrpe -H xxxx.xxx -c check_services -a "e2fsck"
e2fsck: 1
[root@nagios libexec]# echo $?
0

[root@nagios libexec]# ./negate ./check_nrpe -H xxxx.xxx -c check_services -a "e2fsck"
e2fsck: 1
[root@nagios libexec]# echo $?
2


On the host:

[nagios@backup libexec]$ /usr/local/nagios/libexec/check_services -p e2fsck
e2fsck: 1
[nagios@backup libexec]$ echo $?
0
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: negate no longer works after I update Centos 6

Post by lmiltchev »

Everything seems to be working now.
When you check it locally - the process is running and the check exits with "0". When you use "check_nrpe", the result is the same, which is expected. When you use "negate", the exit code is "2".
Can we close this topic and mark it as "resolved"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked