Linux

Check Linux CPU, Process Scheduler and I/O Stats (check_linux_procstat.pl)

Description:

This plugin provides data on CPU Utilization and Linux Schedule by reading /proc/stat parses all data into performance variables. Warning and critical alerts can be issued if CPU Utilization is high.

Current Version

Last Release Date

2012-01-08

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion

License

GPL


Project Files
Project Notes
This plugin parses data from /proc/stat on linux system and outputs CPU utilization and load data. It outputs a lot of info (user, system, iowait, irq for each cpu and number of processes and context switches) as performance data - see plugin code header for more documentation and list of all data it provides. Plugin can be used either directly on the same machine or retrieve data through SNMP if you add snmpexec line similar to below into /etc/snmp/snmpd.conf on the server you want to monitor: --- exec .1.3.6.1.4.1.2021.201 cpustat /bin/cat /proc/stat --- exact OID is your choice, whatever you decide you have to specify that OID as a parameter (-O oid) to plugin and will also then use number of other snmp options (host name, community, etc). To find all available options I recommend you do ./check_linux_procstat.pl -help Usage: ./check_linux_procstat.pl [-v] [[-P | -] | [-O oid -H (-C ) [-2] | (-l login -x passwd [-X pass -L ,) [-p ]]] [-w -c ] [-f] [-t ] [-V] [-N [-n ]] In above options (none of which is actually required) mean: -w and -c allow to specify cpu threshold above which warning or critical alert is issued -N option allows to specify number of real CPUs, this is only used to make nice output -n option allows to specify number of virtual cpus (as reported in /proc/stat), this is used and if the number you specify here is different then what plugin reports, CRITICAL alert will be issued. You can use to make sure you booted into proper SMP kernel. -P is used to specify file to read instead of /proc/stat. If you specify - instead of file name, then data is read from standard input -O, -H, -C, -l, -L, -x, -X are used to retrieve data by SNMP. This will be discontinued in a future version in favor of using check_by_snmp with "-P -" option of this plugin -f is used to active performance output Data for each CPU core provided in performance output includes amount of time each CPU spends in user, system, irq, iowait, idle time. Also provided is data on how many interrupts have been recorded, how many context switches, and number of processes being forked, and currently blocked and running processes. On some systems number of swap & memory pages in/out and disk io in/out paged data is also provided (mostly 2.4 kernel or similar kernel that had this info /proc/stat)
Reviews (1) Add a Review
Doesn't seem to work properly
by jabbasi, June 30, 2013

Could not download the script itself it opened in webage. So I copied and pasted it in vi. When I run it it executes bit it always gives me that Critical warning and all CPUs running at 99% no matter when I run it its same nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~>



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4 (4)
Favorites
0
Views
105,064