<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Here's a script I used to convert bbwarnrules.cfg to hobbit-alerts.cfg.  It's far from perfect, but might help you save some labor.  We also used host groups and page groups fairly extensively in bbwarnsetup.cfg.  This script merges both.</DIV>
<DIV> </DIV>
<DIV><FONT size=2>
<P>#!/bin/bash</P>
<P># Converts bbwarnrules.cfg to hobbit-alerts.cfg format</P>
<P># TO DO: DAY and TIME</P>
<P>#BBWR=/usr/local/bb/etc/bbwarnrules.cfg</P>
<P>#BBWS=/usr/local/bb/etc/bbwarnsetup.cfg</P>
<P>BBWR=bbwarnrules.cfg</P>
<P>BBWS=bbwarnsetup.cfg</P>
<P>OUT1=/tmp/HGA.`date +%s`</P>
<P>HG='hg-'</P>
<P>DHG='$hg-'</P>
<P>PG='pg-'</P>
<P>DPG='$pg-'</P>
<P>#for i in `grep ^hg- $BBWR|tr ' ' '+'`</P>
<P>for i in `cat $BBWR | tr ' ' '+'`</P>
<P>do</P>
<P>if [[ $i == [h][g]* ]]</P>
<P>then</P>
<P># HOST=`echo $i | tr '+' ' ' | awk -F\; '{print $1}'| sed -e s/$HG/$DHG/g`</P>
<P>HGA=`echo $i | awk -F\; '{print $1}'`</P>
<P>if [[ $HGA == *[+]* ]]</P>
<P>then</P>
<P># echo handle multiple hostgroups</P>
<P>echo -n HOST=</P>
<P>for yy in `echo $HGA | tr '+' ' '`</P>
<P>do</P>
<P>grep -w $yy $BBWS|awk -F: '{print $2}' >> $OUT1</P>
<P>done</P>
<P>for xx in `cat $OUT1`</P>
<P>do</P>
<P>echo -n $xx,</P>
<P>done | sed s/.$//</P>
<P>rm $OUT1</P>
<P>else</P>
<P>grep -w $HGA $BBWS | awk -F: '{print $2}' | tr ' ' ',' | sed -e s/,/HOST=/</P>
<P>fi</P>
<P>EXHOST=`echo $i | tr '+' ' ' | awk -F\; '{print $2}'| sed -e s/$HG/$DHG/g`</P>
<P># SERVICE=`echo $i | tr '+' ',' | tr '*' 'x' | awk -F\; '{print $3}' | sed -e s/fping/conn/g`</P>
<P>SERVICE=`echo $i | tr '+' ',' | awk -F\; '{print $3}' | sed -e s/fping/conn/g`</P>
<P>EXSERVICE=`echo $i | tr '+' ',' | awk -F\; '{print $4}'`</P>
<P>DAY=`echo $i | tr '+' ',' | awk -F\; '{print $5}'`</P>
<P>TIME=`echo $i | tr '+' ',' | awk -F\; '{print $6}'`</P>
<P>MAIL=`echo $i | tr '+' ' ' | awk -F\; '{print $7}'`</P>
<P>if [[ $EXHOST != "" ]]</P>
<P>then</P>
<P>echo -n " EXHOST=%$EXHOST"</P>
<P>fi</P>
<P>echo -n " SERVICE=$SERVICE"</P>
<P>if [[ $EXSERVICE != "" ]]</P>
<P>then</P>
<P>echo -n " EXSERVICE=$EXSERVICE"</P>
<P>fi</P>
<P>if [[ $DAY == \* && $TIME == \* ]]</P>
<P>then</P>
<P>true</P>
<P>else</P>
<P>echo -n " TIME=$DAY:$TIME" | tr '-' ':'</P>
<P>fi</P>
<P>echo " RECOVERED"</P>
<P>for m in $MAIL</P>
<P>do</P>
<P>case $m in</P>
<P>ext*)</P>
<P>SCR=`echo " SCRIPT /usr/local/hobbit/server/ext/pg/$m REMEDY" | sed -e s/ext-//g | sed -e s/-tokin//g | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '`</P>
<P>echo -n " "</P>
<P>echo $SCR | awk '{print $1" "$2" "$4" "$3}'</P>
<P>;;</P>
<P>pg-*)</P>
<P>echo " MAIL $m" | sed -e s/$PG/$DPG/g | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '</P>
<P>;;</P>
<P>*)</P>
<P>echo " MAIL $m" | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '</P>
<P>;;</P>
<P>esac</P>
<P>done</P>
<P>echo</P>
<P>elif [[ $i != \#* && $i != \*DC* && $i != notify* && $i != \* && $i != unmatched* && $i != \!* ]]</P>
<P>then</P>
<P>HOST=`echo $i | tr '+' ' ' | awk -F\; '{print $1}'`</P>
<P>EXHOST=`echo $i | tr '+' ' ' | awk -F\; '{print $2}'`</P>
<P>SERVICE=`echo $i | tr '+' ',' | awk -F\; '{print $3}' | sed -e s/fping/conn/g`</P>
<P>EXSERVICE=`echo $i | tr '+' ',' | awk -F\; '{print $4}'`</P>
<P>MAIL=`echo $i | tr '+' ' ' | awk -F\; '{print $7}'`</P>
<P>echo -n "HOST=$HOST" | tr ' ' ','</P>
<P>if [[ $EXHOST != "" ]]</P>
<P>then</P>
<P>echo -n " EXHOST=$EXHOST"</P>
<P>fi</P>
<P>echo -n " SERVICE=$SERVICE"</P>
<P>if [[ $EXSERVICE != "" ]]</P>
<P>then</P>
<P>echo -n " EXSERVICE=$EXSERVICE"</P>
<P>fi</P>
<P>if [[ $DAY == \* && $TIME == \* ]]</P>
<P>then</P>
<P>true</P>
<P>else</P>
<P>echo -n " TIME=$DAY:$TIME" | tr '-' ':'</P>
<P>fi</P>
<P>echo " RECOVERED"</P>
<P>for m in $MAIL</P>
<P>do</P>
<P>case $m in</P>
<P>ext*)</P>
<P>#echo " SCRIPT /usr/local/hobbit/server/ext/pg/$m REMEDY"| sed -e s/ext-//g | sed -e s/-tokin//g | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '</P>
<P>SCR=`echo "SCRIPT /usr/local/hobbit/server/ext/pg/$m REMEDY" | sed -e s/ext-//g | sed -e s/-tokin//g | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '`</P>
<P>echo -n " "</P>
<P>echo $SCR| awk '{print $1" "$2" "$4" "$3}'</P>
<P>;;</P>
<P>pg-*)</P>
<P>echo " MAIL $m" | sed -e s/$PG/$DPG/g | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '</P>
<P>;;</P>
<P>*)</P>
<P>echo " MAIL $m" | sed -e s/\:\~/+DURATION\>/g | tr '+' ' '</P>
<P>;;</P>
<P>esac</P>
<P>done</P>
<P>echo</P>
<P>elif [[ $i == \#* ]]</P>
<P>then</P>
<P>echo $i | tr '+' ' '</P>
<P>else</P>
<P>echo -n '#FIX THIS#'</P>
<P>echo $i | tr '+' ' '</P>
<P>fi</P>
<P>done</P></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR><BR>
<HR>
From: spa@syntec.co.uk<BR>To: hobbit@hswn.dk<BR>Date: Wed, 15 Oct 2008 16:25:16 +0100<BR>Subject: RE: [hobbit] Comma-separated lists of hostnames, etc. in hobbit-alerts.cfg is not documented<BR><BR>
<STYLE>
.ExternalClass DIV
{}
</STYLE>

<DIV dir=ltr align=left><SPAN class=EC_613472115-15102008><FONT face=Arial size=2>Thanks for the suggestion.  I'll certainly give that some thought.  Comma-separated is just the easiest when it comes to converting my existing bbwarnrules.cfg file as I can just select the hosts and replace spaces with commas.  Going forward I had thought of using macros, but I'll look at PAGEs too.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=EC_613472115-15102008><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=EC_613472115-15102008><FONT face=Arial size=2>SebA</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV class=EC_OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> jm54601@yahoo.com [mailto:jm54601@yahoo.com] <BR><B>Sent:</B> 15 October 2008 16:03<BR><B>To:</B> hobbit@hswn.dk<BR><B>Subject:</B> Re: [hobbit] Comma-separated lists of hostnames, etc. in hobbit-alerts.cfg is not documented<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>I struggled with the same thing through a lot of trial and error.  On a related note, I highly recommend trying to get away from using a comma separated list as it's a nightmare to maintain.  I'm working toward using the PAGE token, where a list of hosts on a given page alerts a group, so you're effectively grouping your hosts based on the support team responsible.  There will still be exceptions, but if you can generalize alerts so all the hosts on a given page can alert the same way, you'll save time and avoid the possibility of a host not having an alert configured.  Just my 2 cents.</DIV>
<DIV> </DIV>
<DIV><BR> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: SebA <spa@syntec.co.uk><BR>To: hobbit@hswn.dk<BR>Sent: Wednesday, October 15, 2008 7:43:35 AM<BR>Subject: [hobbit] Comma-separated lists of hostnames, etc. in hobbit-alerts.cfg is not documented<BR><BR><FONT face=Arial size=2>Comma-separated lists of hostnames in hobbit-alerts.cfg is not documented, so maybe we could add something like this (taken from  </FONT><A href="http://hobbitmon.sourceforge.net/docs/man5/hobbit-clients.cfg.5.html" target=_blank rel=nofollow><U><FONT face=Arial color=#0000ff size=2>http://hobbitmon.sourceforge.net/docs/man5/hobbit-clients.cfg.5.html</FONT></U></A><FONT face=Arial size=2>) to </FONT><A href="http://hobbitmon.sourceforge.net/docs/man5/hobbit-alerts.cfg.5.html" target=_blank rel=nofollow><U><FONT face=Arial color=#0000ff
 size=2>http://hobbitmon.sourceforge.net/docs/man5/hobbit-alerts.cfg.5.html</FONT></U></A><FONT face=Arial size=2>:</FONT><BR><FONT face="Courier New" size=2>        HOST=targetstring Rule matching a host by the hostname.  "targetstring"<BR>        is either a comma-separated list of hostnames (from the bb-hosts file),<BR>        "*"  to  indicate "all hosts", or a Perl-compatible regular expression.<BR>        E.g.  "HOST=dns.foo.com,</FONT><A href="http://www.foo.com/" target=_blank rel=nofollow><U><FONT face="Courier New" color=#0000ff size=2>www.foo.com</FONT></U></A><FONT face="Courier New" size=2>"  identifies  two  specific  hosts;<BR>        "HOST=%www.*.<A href="http://foo.com/" target=_blank rel=nofollow>foo.com</A> 
 EXHOST=www-test.foo.com" matches all hosts with a<BR>        name beginning with "www", except the "www-test" host.</FONT> <BR><FONT face=Arial size=2>Adding an example that used the comma-separated syntax to </FONT><A href="http://hobbitmon.sourceforge.net/docs/hobbit-alerts.html" target=_blank rel=nofollow><U><FONT face=Arial color=#0000ff size=2>http://hobbitmon.sourceforge.net/docs/hobbit-alerts.html</FONT></U></A><FONT face=Arial size=2> and hobbit-alerts.cfg (sample) files would also be good.</FONT><BR><FONT face=Arial size=2>And, actually, maybe something to say that the comma-separated syntax can be used in all XXX= places (except, presumably, REPEAT) and also for the recipient.  One really shouldn't have to work this basic stuff out using:</FONT><BR><FONT face=Arial size=2>$</FONT> <FONT face="Courier New" size=2>./bin/bbcmd hobbitd_alert --test</FONT> <BR><FONT face=Arial size=2>!</FONT> <BR><FONT
 face=Arial size=2>We definitely need some more complex examples.  Maybe someone who has a complex and varied hobbit-alerts.cfg can post some sanitized examples that someone can commit to SVN?</FONT><BR><FONT face=Arial size=2>Many thanks,</FONT> <BR><FONT face=Arial size=2>SebA</FONT> <BR></DIV></DIV></DIV><BR></BLOCKQUOTE><BR>
<HR>
Want to do more with Windows Live? Learn “10 hidden secrets” from Jamie. <A href="http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008" target=_blank rel=nofollow>Learn Now</A> </DIV></DIV></div><br>



      </body></html>