Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1


Remember Me

Directory Tree

check_cpu_stats fixed

0 votes
FileDescription v2.2 (Linux,Aix,Solaris)
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Nagios plugin (script) to check CPU Utilization Statistics (user,system,iowait,idle and nice,steal when available in %) with iostat external program reporting performance data
* script download was not possible due to some strange reason, uploaded again and it seems fine now.

Nagios plugin (script) to check cpu utilization statistics. This script has been designed and written on Unix plateform (Linux, Aix), requiring iostat as external program. The location of these can easily be changed by editing the variables $IOSTAT at the top of the script. The script is used to query 4 of the key cpu statistics (user,system,iowait,idle) at the same time. Note though that there is only one set of warning and critical values for iowait percent.

Usage : -w -c -i -n

./check_cpu_stats on AIX and Solaris
CPU STATISTICS OK : user=0.00% system=0.00% iowait=0.00% idle=100.00% | CpuUser=0.00;CpuSystem=0.00;CpuIoWait=0.00;CpuIdle=100.00;30;100

./check_cpu_stats on Linux where iostat outputs an additional column called steal
CPU STATISTICS OK : user=0.00% system=0.00% iowait=0.00% idle=100.00% nice=0.00% steal=0.00% | CpuUser=0.00;CpuSystem=0.00;CpuIoWait=0.00;CpuIdle=100.00;CpuNice=0.00;CpuSteal=0.00;30;100

You can use too provided nagiosgrapher template for this plugin.

Version 2.1
Original link below including graphing templates. Credit goes to these authors.;d=1

Version 2.1.1
Fixed a string that was left open at line 130.
Added labels to the performance data output.
Ipdated the script to work with the bash shell.

Version 2.1.2
Integer math issue arising from bash usage resolved.
Fixed percentage steal output as being idle.

Version 2.2
Added iostat nice output for linux systems.
Added detection support for iostat with or without steal column, if your linux iostat does not show a steal column please let me know if this plugin is working as expected.
Note that nice and steal outputs are appended to the normal data, ensuring the first four columns exist and are identical on all platforms.

The plugin works for me now combined with Pnp4Nagios on a Ubuntu linux machine using Nagios 3.05. If you have output issues (with other platforms), please let me know your iostat output along with the error you are getting.