#!/bin/sh # $Id: nsupdate_ha.sh,v 1.3 2010/10/12 11:09:46 andreav Exp $ # # This code was designed to be used as a "script media type" by ZABBIX server # to notify an authoritative name server that some RR needs to be changed upon # a ZABBIX action generated by a trigger. # cdir=$(dirname $0) if [ "$2" ] ; then if echo "$2" | grep "PROBLEM" > /dev/null 2>&1 ; then # the operation 'send message' configured in ZABBIX is reporting a failure act="failover" fi if echo "$2" | grep "OK" > /dev/null 2>&1 ; then # the operation 'send message' configured in ZABBIX is reporting a recovery act="failback" fi if [ $act ] ; then # send the authenticated update commands to DNS server/s echo "executing $act..." /usr/bin/nsupdate -k $cdir/Kha.valsania.it.+157+16175.private $cdir/$act fi exit 1 else # we expect three arguments from ZABBIX echo "stop: this command requires at least two arguments" exit 1 fi