Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check_CPU_Load_Relative
1.0
2015-05-10
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
GPL
8690
File | Description |
---|---|
check_load_relative.py | check_load_relative.py |
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 scrips displays the relative load for system with multi core cpus.
# CONCEPTS
# ---------
# First of all we need to explain how cpu load works (for linux at least!)
# For a single core cpu if the load is 1 that means its running on full capacity.
# This means the percentage load is 100%.
# Similarly if the load is 0.5 on a single core cpu then percentage load is 50%.
# We can display the calculations for 1 , 8 and 16 core cpus as below:
# ===============================================================================
# ||# of CPUs || LOAD || ABSOLUTE PERCENT(ABS%)|| RELATIVE PERCENT (REL%) ||
# ===============================================================================
# || 01 || 0.50 || = 100 X LOAD = 50.0% || ABS% /# of CPUs =50/01 =50% ||
# || 01 || 1.00 || = 100 X 1.0 = 100% || 100/01 = 100% ||
# || 01 || 2.00 || = 100 X 2.0 = 200% || 200/01 = 200% ||
# || 01 || 10.2 || = 100 X 10.2 = 1020% || 1020/01= 1020% ||
# || 08 || 0.50 || = 100 X 0.50 = 50.0% || 50/08 = 6.25% ||
# || 08 || 1.00 || = 100 X 1.0 = 100% || 100/08 = 12.5% ||
# || 08 || 2.00 || = 100 X 2.0 = 200% || 200/08 = 25.0% ||
# || 08 || 10.2 || = 100 X 10.2 = 1020% || 1020/08= 127.5% ||
# || 16 || 0.50 || = 100 X 0.50 = 50.0% || 50/16 = 3.125% ||
# || 16 || 1.00 || = 100 X 1.0 = 100% || 100/16 = 6.25% ||
# || 16 || 2.00 || = 100 X 2.0 = 200% || 200/16 = 12.5% ||
# || 16 || 10.2 || = 100 X 10.2 = 1020% || 1020/16= 63.75% ||
# ===============================================================================
# As we can see from the above table that ABS% values do not reflect accurate results when # of CPUs is greater than 1.
# This can be addressed in REL%.
# CONCEPTS
# ---------
# First of all we need to explain how cpu load works (for linux at least!)
# For a single core cpu if the load is 1 that means its running on full capacity.
# This means the percentage load is 100%.
# Similarly if the load is 0.5 on a single core cpu then percentage load is 50%.
# We can display the calculations for 1 , 8 and 16 core cpus as below:
# ===============================================================================
# ||# of CPUs || LOAD || ABSOLUTE PERCENT(ABS%)|| RELATIVE PERCENT (REL%) ||
# ===============================================================================
# || 01 || 0.50 || = 100 X LOAD = 50.0% || ABS% /# of CPUs =50/01 =50% ||
# || 01 || 1.00 || = 100 X 1.0 = 100% || 100/01 = 100% ||
# || 01 || 2.00 || = 100 X 2.0 = 200% || 200/01 = 200% ||
# || 01 || 10.2 || = 100 X 10.2 = 1020% || 1020/01= 1020% ||
# || 08 || 0.50 || = 100 X 0.50 = 50.0% || 50/08 = 6.25% ||
# || 08 || 1.00 || = 100 X 1.0 = 100% || 100/08 = 12.5% ||
# || 08 || 2.00 || = 100 X 2.0 = 200% || 200/08 = 25.0% ||
# || 08 || 10.2 || = 100 X 10.2 = 1020% || 1020/08= 127.5% ||
# || 16 || 0.50 || = 100 X 0.50 = 50.0% || 50/16 = 3.125% ||
# || 16 || 1.00 || = 100 X 1.0 = 100% || 100/16 = 6.25% ||
# || 16 || 2.00 || = 100 X 2.0 = 200% || 200/16 = 12.5% ||
# || 16 || 10.2 || = 100 X 10.2 = 1020% || 1020/16= 63.75% ||
# ===============================================================================
# As we can see from the above table that ABS% values do not reflect accurate results when # of CPUs is greater than 1.
# This can be addressed in REL%.
Reviews (1)
I dont have any idea about python, but with this little modify, you can get perfdata
if maxLoad >= critical:
# If load is higher than warning threshold.
print "CRITICAL - relative load is %s" %maxLoad + "%" + "|relativeload=%s;%d;%d" % (maxLoad, warning, critical)
sys.exit(2)
elif maxLoad >= warning:
print "WARNING - relative load is %s" %maxLoad + "%" + "|relativeload=%s;%d;%d" % (maxLoad, warning, critical)
sys.exit(1)
elif maxLoad
if maxLoad >= critical:
# If load is higher than warning threshold.
print "CRITICAL - relative load is %s" %maxLoad + "%" + "|relativeload=%s;%d;%d" % (maxLoad, warning, critical)
sys.exit(2)
elif maxLoad >= warning:
print "WARNING - relative load is %s" %maxLoad + "%" + "|relativeload=%s;%d;%d" % (maxLoad, warning, critical)
sys.exit(1)
elif maxLoad
Owner's reply
Thanks for suggesting the improvements. Those have been incorporated into the script now.