Processes

check_ps.sh

Description:

sh-compliant script to check a specific process and its cpu/memory utilization (PNP Template included)

Current Version

1.0

Last Release Date

2009-05-30

Compatible With

  • Nagios 2.x
  • Nagios 3.x

Owner


Project Files
Project Photos
Project Notes
Description check_ps.sh is a Nagios plugin to check a specific process via ps. You may provide any string as an argument to match a specific process. Please note that the output could be distorted if the argument matches various processes, so please make sure to use unique strings to match a process. check_ps.sh -p firefox -w 10 -c 20 -t cpu Options: -p/--process) You need to provide a string for which the ps output is then greped. -w/--warning) Defines a warning level for a target which is explained below. Default is: off -c/--critical) Defines a critical level for a target which is explained below. Default is: off -t/--target) A target can be defined via -t. Choose between cpu and mem. Default is: mem Output example user@host: ~ $ ./check_ps.sh -p firefox OK - Process: firefox, User: user, CPU: 12.4%, RAM: 17.2%, Start: May29, CPU Time: 12907 min | 'cpu'=12.4 'memory'=17.2 'cputime'=12907 user@host: ~ $ ./check_ps.sh -p firefox -w 5 -c 10 CRITICAL - Process: firefox, User: user, CPU: 12.4%, RAM: 17.2%, Start: May29, CPU Time: 12908 min | 'cpu'=12.4 'memory'=17.2 'cputime'=12908 user@host: ~ $ ./check_ps.sh -p firefox -w 5 -c 20 WARNING - Process: firefox, User: user, CPU: 12.4%, RAM: 17.2%, Start: May29, CPU Time: 12909 min | 'cpu'=12.4 'memory'=17.2 'cputime'=12909 user@host: ~ $ ./check_ps.sh -p firefox -w 20 -c 25 OK - Process: firefox, User: user, CPU: 12.4%, RAM: 17.2%, Start: May29, CPU Time: 12909 min | 'cpu'=12.4 'memory'=17.2 'cputime'=12909 ] user@host: ~ $ ./check_ps.sh -p firefox -w 5 -c 10 -t cpu CRITICAL - Process: firefox, User: user, CPU: 12.4%, RAM: 17.2%, Start: May29, CPU Time: 12923 min | 'cpu'=12.4 'memory'=17.2 'cputime'=12923 user@host: ~ $ ./check_ps.sh -p firefox -w 10 -c 5 Please adjust your warning/critical thresholds. The warning must be lower than the critical level! user@host: ~ $ ./check_ps.sh -p firefox -w 10 Please also set a critical value when you want to use warning/critical thresholds! user@host: ~ $ ./check_ps.sh -p firefox -c 10 Please also set a warning value when you want to use warning/critical thresholds!
Reviews (5) Add a Review
windows?
by newbe95, April 30, 2016

Can I run this script under windows? I receive the message that my parameters are wrong.



Bug in pnp template.
by dannyvz, October 31, 2015

When i use the template i get the message "Undefined offset: 2" Found out that you need to change the following line: $def[2] .= "DEF:cputime=$rrdfile:$DS[3]:AVERAGE " ; To $def[2] = "DEF:cputime=$rrdfile:$DS[3]:AVERAGE " ;



Checks with 'OK' status will return no performance data
by Lang, April 30, 2014

The plugins well but contains a syntax flaw which causes it to NOT return performance data if the check returns an 'OK' status. You will need to correct the following line to allow for performance data on all returns (Critical, Warning & OK). If you don't need trending data of when the return is 'OK', then you have nothing to change. In my environment I would like to see the entire trend, not just the few spikes of when a process goes hot. Original Line: echo "OK - ${output} | ${perfdata} ]" Modified Line to allow perf data: echo "OK - ${output} | ${perfdata}"



Great, but can't get perf graphs to work
by Admin_UCOP, July 31, 2013

The stats are working, but for some reason I just can't seem to figure the issue with the performance graphs. Saved the .php template, named the command after the template and still no graphs. I also re-checked the actual php template and it looks legit to me. Anybody else had this issue?



hope it is usefull...
by geuse, October 31, 2012

pheraps it's usefull to add "-w" to grep instruction. See you. Paolo



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.3 (8)
Favorites
2
Views
239,109