CPU Usage and Load

snmp_remote_load

Description:

# This script takes:
# -H -l -p
# Once given a hostname and community string with or without specific load limit
# with no load limit, using snmp it will look at amount of cpu’s and calculate load average / cpu count –
# — UPDATES – debian – ubuntu systems run:
# sudo apt-get install snmp-mibs-downloader

This has now been updated in the uploaded script, you can revert back to old commented method if you do not with to use HOST-RESOURCES-MIB and find the old commented out method works for you.

Anyhow when executed this is what happens, it returns the actual cpus on the machine, the script has been set to increment by two for any amount found so that we begin to get alerts when the load is really really high rather than as soon as it hits a 100%. This is another hack found further in the script where cpu_count++ occurs twice

# Help -h
./snmp_remote_load -h
./snmp_remote_load -H localhost -l 1 -p public
./snmp_remote_load -H localhost -p public
———————————–
-H is hostname set to localhost
-l is load limit set to 1 or not set at all
-p is snmp passsword
———————————–
You can leave the load blank , this then defines the load according to CPU’s
so a 4 cpu server will have a load set to 6 if it goes above 4 then alerts are sent

# Auto load check against CPU count
./snmp_remote_load -H localhost -p public

./snmp_remote_load -H localhost -l -p public
OK: Actual_cpus:4 – Alert_Limit:6 (1_minute_avg:0.348333, 1_minute_actual=2.09 ) – (5_minutes_avg:0.393333, 5_minutes_actual=2.36 ) – (15_minutes_avg:0.411667, 15_minutes_actual=2.47 ) – | 1_minute_avg=0.348333m;;;0 1_minute_actual=2.09m;;;0 5_minutes_avg=0.393333m;;;0 5_minutes_actual=2.36m;;;0 15_minutes_avg=0.411667m;;;0 15_minutes_actual=2.47m;;;0

./snmp_remote_load -H localhost -l 0.3 -p public
CRITICAL: Actual_cpus:4 – Alert_Limit:0.3 (1_minute_avg:0.331667, 1_minute_actual=1.99 ) – (5_minutes_avg:0.386667, 5_minutes_actual=2.32 ) – (15_minutes_avg:0.408333, 15_minutes_actual=2.45 ) – | 1_minute_avg=0.331667m;;;0 1_minute_actual=1.99m;;;0 5_minutes_avg=0.386667m;;;0 5_minutes_actual=2.32m;;;0 15_minutes_avg=0.408333m;;;0 15_minutes_actual=2.45m;;;0

# Define a limit
./snmp_remote_load -H localhost -p public
OK: Actual_cpus:4 – Alert_Limit:6 (1_minute_avg:0.305, 1_minute_actual=1.83 ) – (5_minutes_avg:0.38, 5_minutes_actual=2.28 ) – (15_minutes_avg:0.406667, 15_minutes_actual=2.44 ) – | 1_minute_avg=0.305m;;;0 1_minute_actual=1.83m;;;0 5_minutes_avg=0.38m;;;0 5_minutes_actual=2.28m;;;0 15_minutes_avg=0.406667m;;;0 15_minutes_actual=2.44m;;;0

Current Version

1.1

Last Release Date

2013-03-27

Compatible With

  • Nagios 3.x

License

GPL


Project Files
Project Notes
define command { command_name check_load_remote command_line $USER1$/snmp_remote_load -H $HOSTADDRESS$ -l $ARG1$ -p $ARG2$ } define command { command_name check_auto_load_remote command_line $USER1$/snmp_remote_load -H $HOSTADDRESS$ -p $ARG1$ } ; this will use the auto command define service{ use .... hostgroup_name generic-uat service_description cpu_load check_command check_auto_load_remote!public! } ; this will set the load max level to 2 define service{ use .... hostgroup_name generic-uat service_description cpu_load check_command check_load_remote!2!public! } ; this will use the default class and not define a load ; have not tested this but should work define service{ use .... hostgroup_name generic-uat service_description cpu_load check_command check_load_remote!!public! }
Reviews (0) Add a Review
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
0 (0)
Favorites
0
Views
42,205