Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
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
Owner
Manish Kumar
Website
http://in.linkedin.com/in/manishkumar85
License
GPL
Compatible With
Returns CPU Load with Top 5 CPU consuming processes
Returns Memory Used with Top 5 Memory consuming processes
Screenshot
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
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.
To use this plugin under linux you may need to convert it with dos2unix tool. It comes in windows format.
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.
You must be logged in to submit a review.
To:
From: