check_nrpe with check_cpu_stats always returns OK on Linux

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

check_nrpe with check_cpu_stats always returns OK on Linux

Post by srikgali »

I see this issue in Nagios Xi , i am getting always OK for even high CPU utilization.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by lmiltchev »

Can you show us the actual command run from the command line along with the output of it? Set the "warning" threshold lower than the "iowait" value to see if the status will change.
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by srikgali »

Thanks for your response.

COMMAND: /usr/local/nagios/libexec/check_nrpe -H <hostname of remote> -t 30 -c check_cpu_stats -a "-c 2 -w 1"
OUTPUT: CPU STATISTICS OK : user=1.75% system=0.75% iowait=0.00% idle=97.49% nice=0.00% steal=0.00% | CpuUser=1.75;CpuSystem=0.75;CpuIoWait=0.00;CpuIdle=97.49;CpuNice=0.00;CpuSteal=0.00;75;80


My intention is get CPU alerts if Linux server Total CPU Utilization ( w - 85% and C-90%) not just the IOWAIT%.
so if %idle is less than 15% then it should alert out Warning message and if %idle is less than 10% then it should alert critical message.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by lmiltchev »

In this case, you will need to use a different plugin as the "check_cpu_stats.sh" one is only reporting on iowait.
[root@192 libexec]# /usr/local/nagios/libexec/check_cpu_stats.sh -h

check_cpu_stats.sh Revision 1.2 - CPU Utilization check script for Nagios

Usage: check_cpu_utilization.sh -w <warning value in % for iowait>

-w Warning level for cpu iowait
-h Show this page

Usage: check_cpu_stats.sh
Usage: check_cpu_stats.sh --help
Usage: check_cpu_stats.sh -w <warning>


Revision 1.2 (c) 2007 Steve Bosek ([email protected])

This plugin will check cpu utilization (user,system,iowait,idle in %)
-w is for reporting warning levels in percent of iowait
I found the "check_linux" stats" plugin on the Nagios Exchange.
https://exchange.nagios.org/directory/P ... ts/details

I haven't tested it but it seems like it is what you are looking for. Give it a try and let us know if this resolved your problem.
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by srikgali »

OH Really, Thanks .
I ran this script on the server side and got below error.

# sh check_CPU_Linux.pl
check_CPU_Linux.pl: line 31: use: command not found
check_CPU_Linux.pl: line 32: use: command not found
check_CPU_Linux.pl: line 33: syntax error near unexpected token `('
check_CPU_Linux.pl: line 33: `use utils qw($TIMEOUT %ERRORS &print_revision &support);'
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by lmiltchev »

This is a perl script. Don't use "sh" to run it. Can you view the plugin's usage by running the following command?

Code: Select all

/path/to/your/plugin/check_CPU_Linux.pl -h
Be sure to check out our Knowledgebase for helpful articles and solutions!
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by srikgali »

I got below output
# ./check_CPU_Linux.pl -h
Can't locate Sys/Statistics/Linux.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./check_CPU_Linux.pl line 35.
BEGIN failed--compilation aborted at ./check_CPU_Linux.pl line 35.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by ssax »

What distro/version is this? If RHEL/CENT, please run this command on the remote machine:

Code: Select all

rpm -qa | grep perl-Sys-Statistics-Linux
If nothing is returned, run this on the remote machine, and try it again:

Code: Select all

yum install perl-Sys-Statistics-Linux

What is the output of this command:

Code: Select all

find / -name Linux.pm
srikgali
Posts: 46
Joined: Thu Apr 07, 2016 9:18 am

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by srikgali »

These are production servers, cant install required rpms. if possible can you suggest any other cpu monitoring plugins?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nrpe with check_cpu_stats always returns OK on Lin

Post by tgriep »

You may want to search the exchange site for a plugin that you do not have to install any modules, etc on your server.
https://exchange.nagios.org/
Most plugins require something to be installed.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked