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
Email: sales@nagios.com

Login

Remember Me

check_cpu.sh (matejunkie)

Rating
5 votes
Favoured:
1
Hits
110927
Files:
FileDescription
check_cpu.phpPNP Template
check_cpu.shThe script (Version 1.0)
LICENSEThe appropriate license
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
sh compliant script to check CPU utilization via /proc/stat instead of top or iostat (PNP template included)
Description

check_cpu.sh is a Nagios plugin to monitor CPU utilization. It makes use of /proc/stat and calculates it through Jiffies rather than using another frontend tool like iostat or top. When using optional warning/critical thresholds all values except idle are aggregated and compared to the thresholds. There's currently no support for warning/critical thresholds for specific usage parameters.
Version

Version 1.0, 2009, Mike Adolphs (http://www.matejunkie.com/)
-h/--help Output

check_cpu.sh [-i/--interval] [-w/--warning] [-c/--critical]

Options:
--interval|-i)
Defines the pause between the two times /proc/stat is being parsed.
Higher values could lead to more accurate result. Default is:
1 second
--warning|-w)
Sets a warning level for CPU user. Default is: off
--critical|-c)
Sets a critical level for CPU user. Default is: off

Output example

user@host:~$ ./check_cpu.sh
OK - user: 8.42, nice: 0.50, sys: 6.66, iowait: 0.50, irq: 0.50, softirq: 0.50 idle: 86.40 | 'user'=8.42 'nice'=0.50 'sys'=6.66 'softirq'=0.50 'iowait'=0.50 'irq'=0.50 'idle'=86.40
Changelog

* 2009-05-14
o Small bugfix of an exit code

Reviews (3)
byunassassinable, April 13, 2012
I don't see any options for monitoring a remote host. Is this possible?
byGeorgThoma, November 29, 2011
This plugins is good but has a small mistake in the PNP4Nagios template. The iowait is 4th value in chech_cpu.php and the 5th value in the perfdata output.

But overall a usefull plugin with nice template.
byMajed, July 17, 2011
./check_cpu_se.sh
gives output on redhat but error on command line 118 and several others on gentoo,
works through nrpe and draws graphs on pnp4nagios