Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Linux CPU Check with Top 5 Processes
2014-08-22
- Nagios 3.x
- Nagios 4.x
- Nagios XI
22949
File | Description |
---|---|
check_cpu_linux.sh | Check Script |
check_cpu_linux.php | PNP4Nagios Template |
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!
- Returns Stats for User, System, and IOWait
- Allows for setting Warning/Critical levels globally or for each individual stat
- When a Warning or Critical threshold is reached for User or System stats, the plugin also returns a list of the 5 processes using the most CPU
- Returns Performance Data
This is a variant on the check script made by Andreas Baess with some new features.
This Plugin provides hopefully all the info you would ever need about your CPU:
- Returns Stats for User, System, and IOWait
- Allows for setting Warning/Critical levels globally or for each individual stat
- When a Warning or Critical threshold is reached for User or System stats, the plugin also returns a list of the 5 processes using the most CPU
- Returns Performance Data
Plugin Requirements:
- IOStat
This is not included by default with all linux distros. To install on Ubuntu (and probably other Debian variants) - apt-get install sysstat
Usage Info (this can also be found using -h):
-w : Global Warning level in % for user/system/io-wait cpu
-uw : Warning level in % for user cpu
-iw : Warning level in % for IO_wait cpu
-sw : Warning level in % for system cpu
-c : Global Critical level in % for user/system/io-wait cpu
-uc : Critical level in % for user cpu
-ic : Critical level in % for IO_wait cpu
-sc : Critical level in % for system cpu
-i : Interval in seconds for iostat (default : 1)
-n : Number report for iostat (default : 3)
I have also included a pnp4nagios template for any interested.
This Plugin provides hopefully all the info you would ever need about your CPU:
- Returns Stats for User, System, and IOWait
- Allows for setting Warning/Critical levels globally or for each individual stat
- When a Warning or Critical threshold is reached for User or System stats, the plugin also returns a list of the 5 processes using the most CPU
- Returns Performance Data
Plugin Requirements:
- IOStat
This is not included by default with all linux distros. To install on Ubuntu (and probably other Debian variants) - apt-get install sysstat
Usage Info (this can also be found using -h):
-w
-uw
-iw
-sw
-c
-uc
-ic
-sc
-i
-n
I have also included a pnp4nagios template for any interested.
Reviews (2)
byGldRush98, July 12, 2017
Works good, just be sure to dos2unix the file like so:
dos2unix check_cpu_linux.sh
dos2unix check_cpu_linux.sh
bybindas, January 15, 2015
0 of 1 people found this review helpful
keep getting error if i execute the script directly.
bash: ./check_cpu_linux.sh: /bin/bash^M: bad interpreter: No such file or directory
if i comment out the shabang (#!/bin/bash) header. then i get this error.
./check_cpu_linux.sh
./check_cpu_linux.sh: line 36: $'\r': command not found
./check_cpu_linux.sh: line 38: $'\r': command not found
./check_cpu_linux.sh: line 40: $'\r': command not found
./check_cpu_linux.sh: line 46: $'\r': command not found
./check_cpu_linux.sh: line 58: $'\r': command not found
./check_cpu_linux.sh: line 63: $'\r': command not found
./check_cpu_linux.sh: line 68: $'\r': command not found
./check_cpu_linux.sh: line 70: syntax error near unexpected token `$'{\r''
'/check_cpu_linux.sh: line 70: `print_release() {
bash: ./check_cpu_linux.sh: /bin/bash^M: bad interpreter: No such file or directory
if i comment out the shabang (#!/bin/bash) header. then i get this error.
./check_cpu_linux.sh
./check_cpu_linux.sh: line 36: $'\r': command not found
./check_cpu_linux.sh: line 38: $'\r': command not found
./check_cpu_linux.sh: line 40: $'\r': command not found
./check_cpu_linux.sh: line 46: $'\r': command not found
./check_cpu_linux.sh: line 58: $'\r': command not found
./check_cpu_linux.sh: line 63: $'\r': command not found
./check_cpu_linux.sh: line 68: $'\r': command not found
./check_cpu_linux.sh: line 70: syntax error near unexpected token `$'{\r''
'/check_cpu_linux.sh: line 70: `print_release() {