Home Directory Plugins Operating Systems UNIX/LINUX SNMP CPU IDLE with STATs

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

UNIX/LINUX SNMP CPU IDLE with STATs

Rating
0 votes
Favoured:
0
Current Version
0.2
Last Release Date
2018-07-30
Compatible With
  • Nagios 3.x
  • Nagios 4.x
License
GPL
Hits
6081
Files:
FileDescription
check_snmp_cpu_stats.plScript 0.1
Services - Unhandled.pngScreenshot
check_snmp_cpu_stats.plScript 0.2
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
UNIX/LINUX SNMP CPU IDLE with STATs
This plugin monitors CPU Idle of UNIX/LINUX OS and gets a lot of additional Info from SNMPD.
Plugin checks are made via SNMP v2c/3 and returns CPU Idle percent in Output and Perfdata and other stats in Performance data.

REQUIRE include .1.3.6.1.4.1.2021 in snmpd.conf

STATS, that are getting by this plugin:
user_cpu_time_percent = .1.3.6.1.4.1.2021.11.9.0
system_cpu_time_percent = .1.3.6.1.4.1.2021.11.10.0
idle_cpu_time_percent = .1.3.6.1.4.1.2021.11.11.0
raw_user_cpu_time = .1.3.6.1.4.1.2021.11.50.0
raw_nice_cpu_time = .1.3.6.1.4.1.2021.11.51.0
raw_system_cpu_time = .1.3.6.1.4.1.2021.11.52.0
raw_idle_cpu_time = .1.3.6.1.4.1.2021.11.53.0
raw_wait_cpu_time = .1.3.6.1.4.1.2021.11.54.0
raw_kernel_cpu_time = .1.3.6.1.4.1.2021.11.55.0
raw_interrupt_cpu_time_oid = .1.3.6.1.4.1.2021.11.56.0

Plugin Requires this perl modules: Net::SNMP, Getopt::Long

Example of plugin usage and results:

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 40 -c 30
SNMP OK - OS: CPU_Idle 91 | 'OS: CPU_Idle'=91;40;30;0;0; user_cpu_time_percent=7 system_cpu_time_percent=1 raw_user_cpu_time=2430124993 raw_nice_cpu_time=1254974 raw_system_cpu_time=431663749 raw_idle_cpu_time=382079558 raw_wait_cpu_time=7422831 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95 -c 80
SNMP WARNING - OS: CPU_Idle 92 | 'OS: CPU_Idle'=92;95;80;0;0; user_cpu_time_percent=6 system_cpu_time_percent=1 raw_user_cpu_time=2430127289 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664080 raw_idle_cpu_time=382100867 raw_wait_cpu_time=7422838 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95 -c 92
SNMP CRITICAL - OS: CPU_Idle 92 | 'OS: CPU_Idle'=92;95;92;0;0; user_cpu_time_percent=6 system_cpu_time_percent=0 raw_user_cpu_time=2430127382 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664097 raw_idle_cpu_time=382112743 raw_wait_cpu_time=7422840 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95:94 -c 92:91
SNMP CRITICAL - OS: CPU_Idle 91 | 'OS: CPU_Idle'=91;95:94;92:91;0;0; user_cpu_time_percent=7 system_cpu_time_percent=1 raw_user_cpu_time=2430130433 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664607 raw_idle_cpu_time=382145091 raw_wait_cpu_time=7422847 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95:94 -c 92:90
SNMP CRITICAL - OS: CPU_Idle 91 | 'OS: CPU_Idle'=91;95:94;92:90;0;0; user_cpu_time_percent=6 system_cpu_time_percent=1 raw_user_cpu_time=2430130599 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664638 raw_idle_cpu_time=382156876 raw_wait_cpu_time=7422848 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95:94 -c 90:80
SNMP CRITICAL - OS: CPU_Idle 90 | 'OS: CPU_Idle'=90;95:94;90:80;0;0; user_cpu_time_percent=8 system_cpu_time_percent=1 raw_user_cpu_time=2430132586 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664860 raw_idle_cpu_time=382166621 raw_wait_cpu_time=7422851 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

$ ./check_snmp_cpu_stats.pl -H 127.0.0.1 -C public -w 95:94 -c 85:80
SNMP OK - OS: CPU_Idle 91 | 'OS: CPU_Idle'=91;95:94;85:80;0;0; user_cpu_time_percent=7 system_cpu_time_percent=1 raw_user_cpu_time=2430133045 raw_nice_cpu_time=1254974 raw_system_cpu_time=431664893 raw_idle_cpu_time=382178111 raw_wait_cpu_time=7422852 raw_kernel_cpu_time=0 raw_interrupt_cpu_time=18599

Nagios commands.cfg config can be like this:

## SNMP CPU Idle with CPU Stats in Perfdata
define command{
command_name check_snmp_cpu_idle_with_stats
command_line $USER1$/contrib/check_snmp_cpu_stats.pl -H $HOSTADDRESS$ -C $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$
}

Service config for Nagios can be like this:

define service{
use generic-service
service_description OS: CPU_Idle
host_name server1.server2
contact_groups server-admins
active_checks_enabled 1
passive_checks_enabled 1
max_check_attempts 1
check_interval 3
retry_interval 5
check_period 24x7
notification_options w,c,r
notification_interval 120
check_command check_snmp_cpu_idle_with_stats!public!161!50!20!
}

############ Changelog ###############
0.2 - SNMPERROR exception
0.1 - initial release.