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 - % used

Rating
2 votes
Favoured:
0
Hits
150724
Files:
FileDescription
check_cpucheck_cpu v0.0.2
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 the amount in % of used cpu on a linux system using either procinfo or sar (whichever is available)
The pourpose of this plugin is to be the simplest check_cpu as possible.
Following the unix philosophy of simplicity and code/tools reusability, it was created aiming maximum use of largely available tools and minimum own code, and even this minumum code is written in (super-simple and highly-portable) Bourne Shell script.
This simplicity was really easy to achieve, since there are already pretty common linux command-line tools that actually do all the dirt job =).
So, in the hopes that this little script may be useful for someone, I present you with this straight-forward, super-simple, zero-bloated, with-no-obscure-dependencies, Bourne Shell script for CPU checking in Linux systems (may work on others POSIX systems too).

The plugin simply tests the existance of procinfo and sar, and uses whichever of them is available (if none of them is available, the plugin fails). Then, it executes the external program grabbing the line which tells the average idle time. From this, it simply deduces the used % and print it suitable for nagios input. Nothing more =)
Reviews (2)
Installed procinfo, then:

$./check_cpu -c 90 -w 80
./check_cpu: 11: ./check_cpu: function: not found
-e
This plugin shows the % of used CPU, using either procinfo or sar (whichever is available)

./check_cpu:
-c If the % of used CPU is above , returns CRITICAL state
-w If the % of used CPU is below CRITICAL and above , returns WARNING state
I am using SUSE 11 and when i run this i am getting
nagios@cubic:~> ./check_cpu -c 95 -w 90
expr: syntax error
OK - CPU used=% idle=% | 'CPU Usage'=%;90;95;
nagios@cubic:~>