Page 1 of 2
check_nrpe with check_cpu_stats always returns OK on Linux
Posted: Mon Jul 18, 2016 10:00 am
by srikgali
I see this issue in Nagios Xi , i am getting always OK for even high CPU utilization.
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 10:30 am
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.
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 10:43 am
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.
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 11:42 am
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.
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 12:59 pm
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);'
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 1:22 pm
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
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 3:10 pm
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.
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 3:32 pm
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:
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 3:52 pm
by srikgali
These are production servers, cant install required rpms. if possible can you suggest any other cpu monitoring plugins?
Re: check_nrpe with check_cpu_stats always returns OK on Lin
Posted: Mon Jul 18, 2016 4:12 pm
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.