Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
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
Owner
Mike Adolphs
Website
http://www.matejunkie.com/
Download URL
http://www.matejunkie.com/process-check-plugin-for-nagios/
Compatible With
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!
Can I run this script under windows? I receive the message that my parameters are wrong.
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 " ;
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}"
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?
pheraps it's usefull to add "-w" to grep instruction. See you. Paolo
You must be logged in to submit a review.
To:
From: