mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
53d6626503
snmptrap/email to notify that a node has changed health status (This used to be ctdb commit ee52c0866e2b26c396fe60946159c559d47199eb)
38 lines
968 B
Bash
Executable File
38 lines
968 B
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 ...
|
|
;;
|
|
esac
|
|
|
|
exit 0
|