Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_cpu - % used
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!
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 =)
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)
bystlouistechy@gmail.com, August 18, 2015
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
$./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
byjabbasi, May 22, 2013
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:~>
nagios@cubic:~> ./check_cpu -c 95 -w 90
expr: syntax error
OK - CPU used=% idle=% | 'CPU Usage'=%;90;95;
nagios@cubic:~>