1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/ctdb/config/notify.sh
Stefan Metzmacher 3419e9c4dd server: add "setup" event
This is needed because the "init" event can't use 'ctdb' commands.

metze

(This used to be ctdb commit 1493436b6b24eb05a23b7a339071ad85f70de8f4)
2010-02-23 10:38:49 +01:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# This script is activated by setting CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
# in /etc/sysconfig/ctdb
# This is script is invoked from ctdb when node UNHEALTHY flag changes.
# and can be used to send SNMPtraps, email, etc
# when the status of a node changes
event="$1"
shift
case $event in
unhealthy)
#
# Send an snmptrap that the node is unhealthy :
# snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb `hostname` 0 0 `date +"%s"` ctdb.nodeHealth.0 i 1
#
# or send an email :
# mail foo@bar -s "`hostname` is UNHEALTHY" ...
#
# or do something else ...
;;
healthy)
#
# Send an snmptrap that the node is healthy again :
# snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb `hostname` 0 0 `date +"%s"` ctdb.nodeHealth.0 i 0
#
# or send an email :
# mail foo@bar -s "`hostname` is HEALTHY" ...
#
# or do something else ...
;;
startup)
# do some extra magic when ctdb has finished the initial
# recovery?
;;
setup)
# do some extra magic when ctdb has setup itself?
;;
init)
# do some extra magic when ctdb has started?
;;
esac
exit 0