Search Exchange
Search All Sites
Login
check_top_process
Checks the top running process on the system. Has arguments for warning and critical levels.
You are forewarned about my coding skills.
Basically, runs ps and finds the process with the highest cpu percentage. Default is to warn above 50% and critical above 80%, but these values can be changed using standard -w and -c syntax (I hope). Works on Linux, probably works other places, uses ps awk standard shell stuff.
Why would you want this? In my case, certain systems will runaway processes spike above a certain percentage cpu usage. If any process runs above a specific mark, I\'m pretty sure I have a runaway process. I can then go kill it before it causes other problems.
Feel free to use or modify the code. It is very simple, but may make a good template or help out someone trying to figure out scripting in nagios.
BTW, I use it through NRPE.
Basically, runs ps and finds the process with the highest cpu percentage. Default is to warn above 50% and critical above 80%, but these values can be changed using standard -w and -c syntax (I hope). Works on Linux, probably works other places, uses ps awk standard shell stuff.
Why would you want this? In my case, certain systems will runaway processes spike above a certain percentage cpu usage. If any process runs above a specific mark, I\'m pretty sure I have a runaway process. I can then go kill it before it causes other problems.
Feel free to use or modify the code. It is very simple, but may make a good template or help out someone trying to figure out scripting in nagios.
BTW, I use it through NRPE.
Reviews (1)
byxoroz, April 24, 2012
It was a nice idea it works allright.
Had to to convert to unix format using
dos2unix check_top_process.sh
thanks for this script
Had to to convert to unix format using
dos2unix check_top_process.sh
thanks for this script


New Listings


