Search All Sites
Nagios Live WebinarsLet our experts show you how Nagios can help your organization.
Don't miss your chance to attend the 2014 Nagios World Conference, Oct 13-16th. Informative Sessions, Networking, Food and Cocktails! Visit go.nagios.com/conference/ for more information or to register.
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
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 : check_cpu_stats.sh -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.
Original link below including graphing templates. Credit goes to these authors.
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.
Integer math issue arising from bash usage resolved.
Fixed percentage steal output as being idle.
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.