From: Guilherme Maciel Ferreira Date: Wed, 23 Mar 2011 16:53:00 +0000 (+0100) Subject: Included script to notify when system is down or up X-Git-Tag: v1.0~118 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=c1d76f1bf00943560ea81156b1090a5fd755ccb4;p=pingcheck Included script to notify when system is down or up --- diff --git a/Readme b/Readme index b14940a..34f33a8 100644 --- a/Readme +++ b/Readme @@ -174,7 +174,8 @@ This configurations are shared among and affect all the hosts. percentage of failed pings to a host exceed this number, then the host is considered down. - status-notifier-cmd: the command line that is called when a host is down, or - up. Accepted variables are ${host}, ${status} + up. Accepted variables are: + ${status} - down or up 4.2. Host diff --git a/conf/pingcheck.conf b/conf/pingcheck.conf index e018d55..c97f5fa 100644 --- a/conf/pingcheck.conf +++ b/conf/pingcheck.conf @@ -1,6 +1,6 @@ limit-hosts-down=4 limit-ping-fail=40 -status-notifier-cmd=echo ${host} is ${status} +status-notifier-cmd=./system_status_alert.sh ${status} [host] name=www.intra2net.com diff --git a/scripts/system_status_alert.sh b/scripts/system_status_alert.sh new file mode 100755 index 0000000..96c5884 --- /dev/null +++ b/scripts/system_status_alert.sh @@ -0,0 +1,29 @@ +#!/bin/sh + + +up() +{ + echo "SYSTEM OK" +} + + +down() +{ + echo "SYSTEM DOWN" +} + + +case $1 in + up) + up + ;; + down) + down + ;; + *) + echo "Usage: system_status_alert {up|down}" + RETVAL=1 +esac + + +exit $RETVAL