CPU Usage and Load

Check_CPU_Load_Relative

Description:

Displays the relative load for system with multi-core CPUs.

Current Version

1.0

Last Release Date

2015-05-10

Compatible With

  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x

Owner

License

GPL


Project Files
Project Notes
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) Add a Review
modification to add perfdata
by Ibizista, May 31, 2016

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



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
4 (1)
Favorites
0
Views
8,623