File: notify.d.README

package info (click to toggle)
samba 2:4.5.16+dfsg-1+deb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 119,272 kB
  • sloc: ansic: 1,353,805; xml: 120,204; python: 119,437; sh: 36,510; perl: 29,946; asm: 3,281; yacc: 2,332; cpp: 2,225; ada: 1,681; exp: 1,582; makefile: 1,365; pascal: 1,089; cs: 879; lex: 603; awk: 118; csh: 58; sed: 45
file content (44 lines) | stat: -rwxr-xr-x 1,278 bytes parent folder | download | duplicates (4)
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
This directory should contain executable programs to handle CTDB event
notifications.  The first and only argument passed to each program is
the event, which is one of:

  init, setup, startup, unhealthy, healthy

To use notifications with this directory then you need to set:

  CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh

in your CTDB configuration file.

An example script that sends SNMP traps for unhealthy/healthy might
look like this:

  #!/bin/sh

  case "$1" in
      unhealthy)
          # Send an SNMP trap saying 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
          ;;
      healthy)
          # Send an SNMP trap saying 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
	  ;;
  esac

Alternatively, email could be sent:

  #!/bin/sh

  case "$1" in
      unhealthy)
          mail -s "$(hostname) is UNHEALTHY" foo@example.com </dev/null >/dev/null 2>&1
          ;;
      healthy)
          mail -s "$(hostname) is HEALTHY" foo@example.com </dev/null >/dev/null 2>&1
          ;;
  esac

When adding programs please note the exclusion patterns in notify.sh.