Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_ps.sh
1.0
2009-05-30
- Nagios 2.x
- Nagios 3.x
238998
File | Description |
---|---|
check_ps.sh | The plugin (v1.0) |
LICENSE | GNU GPLv2 License |
check_ps.php | PNP Template |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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!
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)
Can I run this script under windows? I receive the message that my parameters are wrong.
bydannyvz, October 15, 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 " ;
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 " ;
byLang, April 14, 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}"
Original Line:
echo "OK - ${output} | ${perfdata} ]"
Modified Line to allow perf data:
echo "OK - ${output} | ${perfdata}"
byAdmin_UCOP, July 18, 2013
1 of 1 people found this review helpful
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?
bygeuse, October 1, 2012
pheraps it's usefull to add "-w" to grep instruction.
See you.
Paolo
See you.
Paolo