[Xymon] Synchronize disabled servers from one xymon installation to another?

Ralph Mitchell ralphmitchell at gmail.com
Wed Aug 10 05:13:55 CEST 2011


Well now, there's a blast from the past...  :-)

Ralph Mitchell


On Tue, Aug 9, 2011 at 9:42 PM, Gore, David W (David) <
david.gore at verizon.com> wrote:

> From TJ Yang, he probably has this posted on his site which I don’t recall
> right now.  We may or may not have made edits.  We use it on Red Hat Linux
> Enterprise 5.6.****
>
> ** **
>
> #! /bin/sh****
>
> #
> -----------------------------------------------------------------------------
> ****
>
> #           S H E L L  S C R I P T   S P E C I F I C A T I O N****
>
> #
> -----------------------------------------------------------------------------
> ****
>
> #****
>
> # NAME****
>
> #      bluesync.sh  - A shell script to replicate Primary Xymon Serverblue
> record****
>
> #                     to Secondary standby Xymon server.****
>
> #****
>
> #****
>
> # REVISION HISTORY****
>
> #      07/12/2009    Base on getblue.sh and putblue.sh by Ralph Mitchell
> <ralphmitchell (at) gmail.com>****
>
> #                    http://www.hswn.dk/hobbiton/2009/07/msg00214.html****
>
> #      10/19/2009    T.J. Yang merge two scripts into one for Xymon  High
> Availability setup.****
>
> #****
>
> # USAGE****
>
> #      This script is tested on Solaris 10 OS.****
>
> #      put this shell script in tasks.cfg as section like following.****
>
> #****
>
> # [bluesync]****
>
> # #     DISABLED****
>
> #       ENABLE****
>
> #       ENVFILE /etc/opt/hobbitserver42/hobbitserver.cfg****
>
> #       CMD /opt/hobbitserver42/ext/bluesync/bluesync.sh****
>
> #       LOGFILE $XYMONSERVERLOGS/bluesync.sh.log****
>
> #       INTERVAL 5m****
>
> #****
>
> # DESCRIPTION****
>
> #     Xymon keep its blue(maintenance) in memory, not in a file. This
> script****
>
> #     is to copy the blue records from primary Xymon A server into Xymon B
> secondary one.****
>
> #     This script is for use when running Active-Active type of Xymon
> server****
>
> #     High Availability setup. Xymon B is same as Xymon A except****
>
> #     the alerting function is disabled. There is another script running on
> Xymon B to****
>
> #     detect the outage of Xymon A and enable Xymon B to become primary
> one.****
>
> #****
>
> #****
>
> # Algorithems:****
>
> # 1. Pull blue records from Xymon1 and dump them into Xymon2's ext/xymon
> directory.****
>
> # 2. Process the lifetime fields' value****
>
> #     if lifetime is -1 and greater then zero****
>
> #       then run "bb xymon2.vzbi.com "disable hosname.test lifetime
> message"****
>
> #            to keep the blue record.****
>
> #     if  liftime =0****
>
> #       the run "bb xymon2.vzbi.com "enable  hostname.*d"  to enable this
> host blue record****
>
> #           since it is expired or was enabled on xymon1 server.****
>
> #****
>
> ** **
>
> # RETURN CODE****
>
> #       SUCCESS (=0) - script completed sucessfully****
>
> #       ERROR   (=1) - error... bad things happened****
>
> #       WARNING (=2) - warning... something's not quite right, but it's***
> *
>
> #                      not serious enough to prevent installation.****
>
> #****
>
> #****
>
> # set -x****
>
> ** **
>
> # ---------------------------- CONSTANT DECLARATION
> ---------------------------****
>
> XYMONCFG="/home/xymon/server/etc/xymonserver.cfg"****
>
> BlueTxt="/tmp/xymon1.vzbi.com.blue.txt"****
>
> HB1="xymon1.vzbi.com"****
>
> SED="/bin/sed"****
>
> HB2="xymon2.vzbi.com"****
>
> NOW=`/bin/date +%s`****
>
> EXPR="/usr/bin/expr"****
>
> RM="/bin/rm"****
>
> SUCCESS=0****
>
> ERROR=1****
>
> WARNING=2****
>
> export SUCCESS ERROR WARNING****
>
> # inherit xymon server variables in configuration file****
>
> #. ${XYMONCFG}****
>
> ** **
>
> # ---------------------------- VARIABLE DECLARATION
> ---------------------------****
>
> exit_code=${SUCCESS}****
>
> ** **
>
> # ******************************** MAIN SCRIPT
> ************************************
>
> ** **
>
> # remove the old file first.****
>
> if [ -f ${BlueTxt} ]; then****
>
>         ${RM} ${BlueTxt}****
>
>         exit_code=$?****
>
> fi****
>
> ** **
>
> # Getting blue records into a text file.****
>
> ** **
>
> if [ ${exit_code} -eq ${SUCCESS} ]; then****
>
>    $XYMON ${HB1} "xymondboard color=blue
> fields=hostname,testname,disabletime,dismsg" |****
>
>            ${SED} -e 's/\\/\\\\/g'  > ${BlueTxt}****
>
> exit_code=$?****
>
> fi****
>
> ** **
>
> if [ ${exit_code} -eq ${SUCCESS} ]; then****
>
>     cat ${BlueTxt} | while read line****
>
>     do****
>
>       OFS="$IFS"****
>
>       IFS="|"****
>
>       set $line****
>
>       IFS="$OFS"****
>
>       if [ "$3" -eq "-1" ]; then****
>
>         # found "disable until OK"****
>
>         lifetime="-1"****
>
>       else****
>
>         lifetime=`$EXPR $3 - ${NOW}`****
>
>         if [ "$lifetime" -le "0" ]; then****
>
>           # this one expired, enable it****
>
>           $XYMON ${HB2} "enable $1.*"****
>
>         else****
>
>           lifetime="$lifetime"s****
>
>         fi****
>
>       fi****
>
>       msg=`echo "$4" | $SED -e 's/\\\n/\n/g'`****
>
>       $XYMON ${HB2} "disable $1.$2 $lifetime $msg"****
>
>     done****
>
> exit_code=$?****
>
> fi****
>
> ** **
>
> exit ${exit_code}****
>
> ** **
>
> ** **
>
> David Gore (v965-3670)
> Network Management Systems (NMS)
> IMPACT Transport Team Lead - SCSA, SCNA
> Page: 1-800-PAG-eMCI pin 1406090
> Vnet: 965-3676****
>
> ** **
>
> *From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] *On
> Behalf Of *Carl Melgaard
> *Sent:* Tuesday, August 09, 2011 13:37
> *To:* 'xymon at xymon.com'
> *Subject:* [Xymon] Synchronize disabled servers from one xymon
> installation to another?****
>
> ** **
>
> Hi,****
>
> ** **
>
> Is there an easy way to synchronize xymon disabled status (servers put in
> maintenance) from 1 xymon server to another (a standby server)?****
>
> ** **
>
> /melgaard****
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20110809/0ed4d5c4/attachment.html>


More information about the Xymon mailing list