Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check long running processes
1.11
2013-11-04
- Nagios 3.x
GPL
35370
File | Description |
---|---|
check_long_running_procs.sh | check_long_running_procs.sh |
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!
IMPORTANT: This script checks elapsed CPU time not elapsed run time.
This script will take multiple arguments and alert if a process has consumed more than x number of CPU days e.g:
$ check_long_running_procs.sh -w 10 -c 20
LONG RUNNING PROCESSES WARNING: there is/are 1 long running processes on `hostname`
WARNING PID 950 () from user has used 12 CPU days and has run for a total of 13 days
The script has an optional space seperated exclude list e.g
$ check_long_running_procs.sh -w 10 -c 20 -E "sge pdflush"
The script also has a hidden function which can email a user with a warning message informing them of their long running process. You can enable this by using the “-e” flag followed by your username. You will also need to set the “DOMAIN” variable to your domain name. This function assumes your email address is@ if not you might need to recode a little.
IMPORTANT: This script checks elapsed CPU time not elapsed run time. However it would be pretty easy to recode the check to report on total run time rather than CPU time.
$ check_long_running_procs.sh -w 10 -c 20
LONG RUNNING PROCESSES WARNING: there is/are 1 long running processes on `hostname`
WARNING PID 950 (
The script has an optional space seperated exclude list e.g
$ check_long_running_procs.sh -w 10 -c 20 -E "sge pdflush"
The script also has a hidden function which can email a user with a warning message informing them of their long running process. You can enable this by using the “-e” flag followed by your username. You will also need to set the “DOMAIN” variable to your domain name. This function assumes your email address is
IMPORTANT: This script checks elapsed CPU time not elapsed run time. However it would be pretty easy to recode the check to report on total run time rather than CPU time.
Reviews (1)
byit-praktyk, February 5, 2020
Proposed updates
CPU_DAYS=`if [[ $UTIME != *-* ]]; then echo "0"; else echo $UTIME | awk -F"-" '{print $1}'; fi`
RUN_DAYS=`if [[ $ETIME != *-* ]]; then echo "0"; else echo $ETIME | awk -F"-" '{print $1}'; fi`
CPU_DAYS=`if [[ $UTIME != *-* ]]; then echo "0"; else echo $UTIME | awk -F"-" '{print $1}'; fi`
RUN_DAYS=`if [[ $ETIME != *-* ]]; then echo "0"; else echo $ETIME | awk -F"-" '{print $1}'; fi`