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_CPU_Load_Relative

Current Version
1.0
Last Release Date
2015-05-10
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
Owner
License
GPL
Hits
8409
Files:
FileDescription
check_load_relative.pycheck_load_relative.py
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Displays the relative load for system with multi-core CPUs.
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%.
Reviews (1)
byIbizista, May 31, 2016
1 of 1 people found this review helpful
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
Owner's reply

Thanks for suggesting the improvements. Those have been incorporated into the script now.