ctdb-protocol: Fix typo in type of return variable
[samba.git] / ctdb / config / notify.d.README
1 This directory should contain executable programs to handle CTDB event
2 notifications.  The first and only argument passed to each program is
3 the event, which is one of:
4
5   init, setup, startup, unhealthy, healthy
6
7 To use notifications with this directory then you need to set:
8
9   CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
10
11 in your CTDB configuration file.
12
13 An example script that sends SNMP traps for unhealthy/healthy might
14 look like this:
15
16   #!/bin/sh
17
18   case "$1" in
19       unhealthy)
20           # Send an SNMP trap saying that the node is unhealthy:
21           snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
22               $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 1
23           ;;
24       healthy)
25           # Send an SNMP trap saying that the node is healthy again:
26           snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
27               $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 0
28           ;;
29   esac
30
31 Alternatively, email could be sent:
32
33   #!/bin/sh
34
35   case "$1" in
36       unhealthy)
37           mail -s "$(hostname) is UNHEALTHY" foo@example.com </dev/null >/dev/null 2>&1
38           ;;
39       healthy)
40           mail -s "$(hostname) is HEALTHY" foo@example.com </dev/null >/dev/null 2>&1
41           ;;
42   esac
43
44 When adding programs please note the exclusion patterns in notify.sh.