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

Directory Tree

check_cpu.sh

Current Version
1.0
Last Release Date
2009-05-14
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Hits
117595
Files:
FileDescription
check_cpu.shThe plugin (v1.0)
check_cpu.phpThe appropriate PNP Template
LICENSEGNU GPLv2 License
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
check_cpu.sh
sh-compliant script to check CPU utiliziation via Jiffies instead of parsing another frontend tool
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.

-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
* Small bugfix of an exit code
Reviews (1)
bydgardella, February 23, 2012
Just One small correction , the pnp4nagios has an error with name of the fields :


$def[1] = "DEF:used=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "DEF:nice=$rrdfile:$DS[2]:AVERAGE " ;
$def[1] .= "DEF:sys=$rrdfile:$DS[3]:AVERAGE " ;
$def[1] .= "DEF:softirq=$rrdfile:$DS[4]:AVERAGE " ;
$def[1] .= "DEF:iowait=$rrdfile:$DS[5]:AVERAGE " ;
$def[1] .= "DEF:irq=$rrdfile:$DS[6]:AVERAGE " ;
$def[1] .= "DEF:idle=$rrdfile:$DS[7]:AVERAGE " ;


Regards,Diego