File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 46
46
# return new AlarmStatus(CRITICAL, 'Process not running.');
47
47
# }
48
48
#
49
+ # if (metric['process_age'] > 86400) {
50
+ # return new AlarmStatus(WARNING, 'Process has been running for over 24 hours.');
51
+ # }
52
+ #
49
53
# return new AlarmStatus(OK, 'Process running normally.');
50
54
51
55
function help {
52
56
53
57
cat << HELP
54
58
55
- SYNOPSIS: ./process_mon.sh [process]...
59
+ SYNOPSIS: ./process_mon.sh [process]...
56
60
USAGE EXAMPLE: ./process_mon.sh lsync
57
61
58
62
HELP
@@ -64,4 +68,14 @@ if [ -z "$1" ]; then
64
68
fi
65
69
66
70
process_check=` ps ax | grep -v grep | grep -v process_mon | grep -c " $1 " `
71
+ process_pid=` ps ax | grep -v grep | grep -v process_mon | grep " $1 " | head -n 1 | awk ' {print $1}' `
72
+ if (( $process_check > 0 )) ; then
73
+ process_age=` ps -o etimes= -p " $process_pid " `
74
+ process_age=${process_age## }
75
+ fi
76
+
67
77
echo " metric process_mon int $process_check "
78
+ echo " metric process_pid int ${process_pid:- 0} "
79
+ echo " metric process_age int ${process_age:- 0} "
80
+
81
+ exit 0
You can’t perform that action at this time.
0 commit comments