mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
install a default /etc/ctdb/notify.sh script as example on how to use
snmptrap/email to notify that a node has changed health status (This used to be ctdb commit ee52c0866e2b26c396fe60946159c559d47199eb)
This commit is contained in:
parent
ad40ee25f9
commit
53d6626503
@ -222,6 +222,7 @@ install: all
|
||||
if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -m 644 doc/ctdb.1 $(DESTDIR)$(mandir)/man1; fi
|
||||
if [ -f doc/ctdbd.1 ];then ${INSTALLCMD} -m 644 doc/ctdbd.1 $(DESTDIR)$(mandir)/man1; fi
|
||||
if [ -f doc/onnode.1 ];then ${INSTALLCMD} -m 644 doc/onnode.1 $(DESTDIR)$(mandir)/man1; fi
|
||||
if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 644 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
|
||||
|
||||
test: all
|
||||
tests/run_tests.sh
|
||||
|
37
ctdb/config/notify.sh
Executable file
37
ctdb/config/notify.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/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
|
@ -97,6 +97,7 @@ fi
|
||||
%defattr(-,root,root)
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/ctdb
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/notify.sh
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/functions
|
||||
%attr(755,root,root) %{initdir}/ctdb
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user