summaryrefslogtreecommitdiffstats
path: root/ctdb/config/notify.sh
blob: 8d3eb87f202b2b7eb636306904c1c28377215d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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