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

2 votes
check_cpucheck_cpu v0.0.2
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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
This plugin shows the % of used CPU, using either procinfo or sar (whichever is available)

-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;