ctdb-scripts: Change directory for notifications to events/notification
[kai/samba-autobuild/.git] / ctdb / config / notification.README
1 This directory should contain executable programs ending in ".script"
2 to handle CTDB event notifications.  The first and only argument
3 passed to each program is the event, which is one of:
4
5   init, setup, startup, unhealthy, healthy
6
7 An example script that sends SNMP traps for unhealthy/healthy might
8 look like this:
9
10   #!/bin/sh
11
12   case "$1" in
13       unhealthy)
14           # Send an SNMP trap saying that the node is unhealthy:
15           snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
16               $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 1
17           ;;
18       healthy)
19           # Send an SNMP trap saying that the node is healthy again:
20           snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
21               $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 0
22           ;;
23   esac
24
25 Alternatively, email could be sent:
26
27   #!/bin/sh
28
29   case "$1" in
30       unhealthy)
31           mail -s "$(hostname) is UNHEALTHY" foo@example.com </dev/null >/dev/null 2>&1
32           ;;
33       healthy)
34           mail -s "$(hostname) is HEALTHY" foo@example.com </dev/null >/dev/null 2>&1
35           ;;
36   esac