[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] How do I clone maintenance mode record ?



I realised earlier that the disabletime value coming from hobbitdboard is
actually a unix timestamp, but the disable command wants a duration in the
form of seconds, minutes or hours.  Again, this works with Ubuntu, and
probably any other Linux, but maybe not in a different Unix.  It relies on
the GNU date command, for a start...  :)

========== putblues.sh ==========
     #!/bin/sh

     . /home/xymon/server/etc/hobbitserver.cfg

     cat $1 | while read line
     do
       OFS="$IFS"
       IFS="|"
       set $line
       IFS="$OFS"
       if [ "$3" -eq "-1" ]; then
         # found "disable until OK"
         lifetime="-1"
       else
         now=`date +%s`
         lifetime=`$EXPR $3 - $now`
         if [ "$lifetime" -le "0" ]; then
           # this one expired, ignore it
           continue
         else
           lifetime="$lifetime"s
         fi
       fi
       msg=`echo "$4" | $SED -e 's/\\\n/\n/g'`
       $BB localhost "disable $1.$2 $lifetime $msg"
     done
========== cut here ==========

Ralph Mitchell


On Sat, Jul 11, 2009 at 12:52 AM, Ralph Mitchell <ralphmitchell (at) gmail.com>wrote:

> On Fri, Jul 10, 2009 at 8:19 AM, T.J. Yang <tj_yang (at) hotmail.com> wrote:
>
>> In Ralph Mitchell (ralphmitchell (at) gmail.com)
>>                reply email,
>> There are getblue.sh and putblue.sh to do the collecting on primary and
>> populating on DR/standby hobbit server.
>>
>> I tired it but I found the putblue.sh is not working. I still can't see
>> the same list of maintenance hosts between the twos, even the get and put
>> blue shell ran sucessfully.
>>
>> This may caused by lacking of running bbpage alert module on DR/Secondary
>> module. Is your DR hobbit server has alert module disabled and your script
>> still works ?
>>
>> Would you mind to send to the list or send it to my email account ? I like
>> to learn how you did it.
>
>
> As I said, I only tried it in Ubuntu, so I would expect it to work in any
> Linux distribution.  I'm still setting up other servers in VMware for
> fooling around with this kind of thing.  What OS do you have??
>
> Ralph Mitchell
>
>