CPU Usage and Load

CPU Stats/Memory Used Plugin – Top 5 CPU/Memory Consuming Processes for Unix Servers

Description:

Returns the CPU Stats & Memory Used for all unix servers (tested on HPUX, should work on all), with Top 5 CPU or Memory consuming process details like ProcessID, ProcessName, CPU% or MemKB(used). Very useful when you got an alert from Nagios or an integrated ticketing tool with the details like which all process caused the high cpu load or memory load on your production servers, no need to login individually and check on that monitored server, it will provide you the information right out of the Nagios UI & the Nagios Alerts or Tickets.

Current Version

v1.0

Last Release Date

2012-10-19

Compatible With

  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion

Owner

License

GPL


Project Files
Project Photos
Project Notes
Reviews (4) Add a Review
Patched scripts
by micharg, May 31, 2019

Hi all, unfortunately the comment does not allow attaching scripts. I have patched the 2 provided scripts to work on Linux (they fail now). Tried with CentOS 7.x. Can you please review and update the current versions (that are since 2012)? The patched files and more information (also for prerequisites) on https://micharg.blogspot.com/2019/05/patched-nagios-scripts-to-monitor-top-5.html



Good, but it needed some changes
by DutchEagleon, May 31, 2016

I tested both of them on CentOS 7.2, the CPU check worked after dos2unix. But the MEM check needed some more changes. The script used "machinfo" but this isn't a command in CentOS. So I used "cat /proc/meminfo | grep Memtotal" I also changed the total free memory, to this command: # Total memory available totalmem=`cat /proc/meminfo | grep -i memtotal` totalmem=`echo $totalmem | awk '{print $2}'` #totalmem=`echo "$totalmem * 1024" | bc` #echo "TotalMem=$totalmem" #Total Free Memory freemem=`cat /proc/meminfo | grep -i memfree` freemem=`echo $freemem | awk '{print $2}'` I also had a problem with "bc", I constantly got a error about the decimal that was included. But I changed the calculation so it wouldn't get the error anymore: # Total memory used usedmem=`echo "$totalmem - $freemem" | bc -l` #echo "UsedMem=$usedmem" #Percent Used Mem for Calculation. percused=`echo $usedmem / $totalmem | bc -l` #Percent Used Mem percentused=`echo "scale=0;($percused * 100/1)" | bc -l` #echo "PercentUsedMem=$percentused" percentfree=`echo "100 - $percentused" | bc -l` And I got an integer expression on line 123, so I changed the command a bit. OUTPUT=";Top 5 Memory Processes(memKB,pname,pid): " ; for word in $COMMAND; do i=`expr $i + 1` j=`expr $j + 1` if [[ $i -eq 3 ]]; then i=0; if [ $j -eq 15 ]; then OUTPUT="$OUTPUT `echo $word`" ; else OUTPUT="$OUTPUT `echo $word, `" ; fi else if [ "$i%3" = "1" ]; then ## It was this: [ $i%3 -eq 1 ] ## OUTPUT="$OUTPUT `echo $word"KB"`" ; else OUTPUT="$OUTPUT `echo $word `" ; fi fi done After I made this changes it worked fine.



dos2unix
by yabonio, January 31, 2016

To use this plugin under linux you may need to convert it with dos2unix tool. It comes in windows format.



Some problem for the plugin
by sandyzd, November 30, 2012

Hi Manish Kumar, I left a email in your Gmail,please check it. There are some screenshots in my email. Please help me to solve the problem.Thank you very much.



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.5 (6)
Favorites
4
Views
81,633