Home Directory Plugins Operating Systems Linux Check Linux CPU, Process Scheduler and I/O Stats (check_linux_procstat.pl)

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 Linux CPU, Process Scheduler and I/O Stats (check_linux_procstat.pl)

Last Release Date
2012-01-08
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
Owner
License
GPL
Hits
105061
Files:
FileDescription
check_linux_procstat.plcheck_linux_procstat.pl - v. 0.3 (circa 2008)
check_linux_procstat.plcheck_linux_procstat.pl - v 0.4 (Jan 2012)
check_linux_procstat.phppnp4nagios (>=0.6) template for check_linux_procstat >= v. 0.4 (Jan 2012). this template will work for any number of cpus
linuxcpuio_2xeon_2scsi.ncfgexample of nagiosgrapher template for system with 2 dual-core cpus and 2 scsi disks, this is for redhat 4 system (circa 2008). you should cut out extra or all disks and change names based on your own system
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!
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.
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 mmunity>) [-2] | (-l login -x passwd [-X pass -L ,) [-p ]]] [-w %> -c ] [-f] [-t ] [-V] [-N [-n s>]]

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)
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:~>
Owner's reply

There are some systems where total of user+system+io comes to 99%. This may well be normal for your system (and good if its so) and you should not complain and say the plugin does not work. So this 1-star rating is totally uncalled for and previously plugin had only 5-star ratings.

The plugin itself is mostly used for graphing of system load using provided pnp template. It is the only plugin that allows you to have this comprehensive User/System/IO graphs and people have thanked me for that many times.

But I would agree that main plugin functionality should be improved and status line show have user/system/io percentages too and then people would not get surprised they see 99% total. I'll add this sometime this year.