Included script to notify when system is down or up
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Wed, 23 Mar 2011 16:53:00 +0000 (17:53 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Thu, 24 Mar 2011 09:06:39 +0000 (10:06 +0100)
Readme
conf/pingcheck.conf
scripts/system_status_alert.sh [new file with mode: 0755]

diff --git a/Readme b/Readme
index b14940a..34f33a8 100644 (file)
--- 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
index e018d55..c97f5fa 100644 (file)
@@ -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 (executable)
index 0000000..96c5884
--- /dev/null
@@ -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