From: Michael Peters Date: Tue, 14 May 2013 18:27:14 +0000 (-0400) Subject: Add check_lock plugin for NRPE monitoring X-Git-Tag: GenaSYS-2.4.0~23 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e94fcb2e412220a9171c0a8fbb651526d0ef3244;p=contrib%2Fpines%2Fgenasys.git Add check_lock plugin for NRPE monitoring Signed-off-by: Andy Witter --- diff --git a/templates/monitor/check_lock b/templates/monitor/check_lock new file mode 100755 index 0000000..6a701e7 --- /dev/null +++ b/templates/monitor/check_lock @@ -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 + + +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