Problem with check_cpu plugin.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
JkmT
Posts: 3
Joined: Wed Jun 24, 2015 9:03 am

Problem with check_cpu plugin.

Post by JkmT »

Hi all,
Few weeks ago I was asked to administer another Nagios system, and observed some strange behaviour of check_cpu_perf plugin.

Problem:
1) When I try to call check_cpu via nrpe on app02 machine I got response but without values:

Code: Select all

[root@nagios /]# /usr/lib64/nagios/plugins/check_nrpe -H app02 -c check_cpu -a 30 50
OK: CPU Idle = % | CpuUser=; CpuNice=; CpuSystem=; CpuIowait=; CpuSteal=; CpuIdle=:20:10
2) When one tries to check this on other machine it works:

Code: Select all

[root@nagios /]# /usr/lib64/nagios/plugins/check_nrpe -H app01 -c check_cpu -a 30 50
OK: CPU Idle = 98.91% | CpuUser=0.91; CpuNice=0.00; CpuSystem=0.18; CpuIowait=0.00; CpuSteal=0.00; CpuIdle=98.91:20:10
3) When I try to call particular plugin directly from app02 machine it returns proper values:

Code: Select all

[root@app02 ~]#  /usr/lib64/nagios/plugins/check_cpu_perf.sh 50 30
OK: CPU Idle = 98.70% | CpuUser=1.10; CpuNice=0.00; CpuSystem=0.20; CpuIowait=0.00; CpuSteal=0.00; CpuIdle=98.70:20:10
As it does on the other one:

Code: Select all

[root@app01 ~]# /usr/lib64/nagios/plugins/check_cpu_perf.sh 50 30
OK: CPU Idle = 99.10% | CpuUser=0.73; CpuNice=0.00; CpuSystem=0.17; CpuIowait=0.00; CpuSteal=0.00; CpuIdle=99.10:20:10
From the first (and second ;) point of view nagios configuration is the same at all six servers, there are over 80 services being monitored
and only this one check_cpu behaves in such strange manner..
I have googled a lot during last days, checked also debug from Nagios server, which gave me nothing more than those empty values from point 1.

Thanks in advance for any support in this case - I have been stucked :(

Regards,
John
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Problem with check_cpu plugin.

Post by ssax »

Edit the files and look at the top and see if the versions are the same on the working and non-working ones.

What version are you using?
JkmT
Posts: 3
Joined: Wed Jun 24, 2015 9:03 am

Re: Problem with check_cpu plugin.

Post by JkmT »

If you mentioned the header of check_cpu_perf.sh file - it's the same on all machines and version is 2011090802.
BR,
John
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Problem with check_cpu plugin.

Post by jdalrymple »

On app02 try running the check as user nagios (or whatever user the nrpe daemon is running as) - I suspect you'll find it fails at that point. If so a sudoers rule and adjustment of the nrpe file (add sudo in front of the command) may be in order.

Also if you have selinux running on app02 there may be some debugging to be done there.
JkmT
Posts: 3
Joined: Wed Jun 24, 2015 9:03 am

Re: Problem with check_cpu plugin.

Post by JkmT »

I face some problems with using su - nagios -c "nrpe command", but I face them on both servers - app1 and app2.
Also Selinux is enabled on both machines and quick view suggests that configuration is similar :(
BR, John
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Problem with check_cpu plugin.

Post by jdalrymple »

JkmT wrote:I face some problems with using su - nagios -c "nrpe command", but I face them on both servers - app1 and app2.
Sounds like you need to add a sudoers rule for the nagios user. It also sounds like on app1 your nrpe daemon isn't running as the nagios user which isn't a great thing for security.

In /etc/sudoers:

Code: Select all

nagios ALL= NOPASSWD:/usr/lib64/nagios/plugins/check_cpu_perf.sh 50 30
Then in nrpe.cfg

Code: Select all

command[check_cpu]=sudo /usr/lib64/nagios/plugins/check_cpu_perf.sh 50 30
This assumes that nrpe is running as user nagios
Locked