Add check_lock plugin for NRPE monitoring
authorMichael Peters <mpeters@emeralddata.net>
Tue, 14 May 2013 18:27:14 +0000 (14:27 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Tue, 14 May 2013 18:27:14 +0000 (14:27 -0400)
Signed-off-by: Andy Witter <awitter@georgialibraries.org>
templates/monitor/check_lock [new file with mode: 0755]

diff --git a/templates/monitor/check_lock b/templates/monitor/check_lock
new file mode 100755 (executable)
index 0000000..6a701e7
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Author       : Dave Brown, Sys Admin, ESI
+# Last Updated : July 7, 2009
+# Purpose      : Check status of file name and process from CL variables.
+# Usage        : simple.sh <filename> <process>
+
+
+scriptname=$0
+filetocheck=$1
+proctocheck=$2
+
+if [ -f $filetocheck ]; then
+  if [ "$(ps aux | grep -i $proctocheck | grep -v grep | grep -v $scriptname | wc -l)" -gt 0 ]; then
+       echo "OK: $filetocheck exists and $proctocheck running"
+            exit 0
+              else
+                   echo "CRIT: $filetocheck exists but $proctocheck not running"
+                        exit 2
+                          fi
+                          else
+                            echo "OK: $filetocheck not found"
+                              exit 0
+                              fi