<HTML>
<HEAD>
<TITLE>Re: [hobbit] Ack events sent to multiple BBDISP (issue with bback.cgi and cookies)</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Lucida Grande"><SPAN STYLE='font-size:10pt'>Hi,<BR>
<BR>
A co-worker worked on the multiple BBDISP ack problem i posted here in February, and i'd like to share his work :-)<BR>
<BR>
Here his investigation results and the fix :<BR>
<BR>
1.  Hobbit does not allow ack's without the correct acknowledgement number as it  is this acknum that is used to look up the {HOST}.{TEST} to be acknowledged.  So there was no way that the simple trick of using the main/ area section in  hobbitserver.cfg was going to work. A side note.... -{ACKNUM} will acknowledge  all events for {HOST}<BR>
  <BR>
 2. The code only ever forwards to the first IP listed in  BBDISPLAYS if the messages type is not one of those as defined in lib/sendmsg.c:multircptcmds.<BR>
<BR>
static char *multircptcmds[] = { "status", "combo",  "meta", "data", <BR>
"notify", "enable", "disable", "drop", "rename", "client",  NULL };<BR>
<BR>
3. The ordering of the parameters in hobbitcfg.conf is  critical. The --area  must be prior to the --env file parameter so that the  correct environment is  selected.<BR>
  <BR>
4.  We need to use --nopin<BR>
  <BR>
5.  We can keep the cookies enabled<BR>
<BR>
<BR>
The Fix :D<BR>
<BR>
<BR>
The new bb-ack.cgi now does the following:<BR>
<BR>
1.  Grab a list of all acknowledgable events from the list of Hobbit BBDISPLAY  servers.<BR>
<BR>
2.  Present the normal looking "Acknowledge Alert" page, showing the list of  <BR>
events and entry fields to send acknowledgements.<BR>
<BR>
3.  Send the acknowledgements to the relevant BBDISPLAY  servers.<BR>
<BR>
4.  Provide feedback as normal for the acknowledgements sent.<BR>
<BR>
  <BR>
The  Configuration:<BR>
<BR>
1.  Change the CGI_ACK_OPTS setting in /opt/hobbit/server/etc/hobbitcgi.conf  <BR>
to:-<BR>
<BR>
CGI_ACK_OPTS="--area=maint  --env=/opt/hobbit/server/etc/hobbitserver.cfg  --no-pin"<BR>
 <BR>
2.  Add to ~hobbit/server/etc/hobbitserver.conf<BR>
<BR>
#  acks for others  hobbit servers<BR>
maint/BBDISP="0.0.0.0"<BR>
maint/BBDISPLAYS="$BBSERVERIP  10.0.0.2 10.0.0.3"<BR>
#  acks end<BR>
 <BR>
Known Issues:<BR>
 <BR>
1.  Not fully tested =-o<BR>
  <BR>
     Could be issues with performance if the  BBDISPLAY list is long.<BR>
  <BR>
     If a BBDISPLAY does not respond (IP is unbound, etc.)  then there is a  delay while the TCP connect timesout [order of a few  seconds].<BR>
  <BR>
     Theoretical possibility of timing issue between alerts  being 'raised' and  acknowledged while the alerts are being propogated  between BBDISPLAYS.<BR>
  <BR>
2.  CGI code is not fantastically 'safe' but I think that's constant with the rest  of the code (i.e. I haven't made it any worse!) :/.<BR>
<BR>
<BR>
Find the new bb-ack.c in attachment. The modifications done are commented between /* Begin Changes for multiBBDISPLAYS for acks */ tag.<BR>
<BR>
Henrik, if this fix is ok for you, it could be good to add it into xymon.<BR>
<BR>
Regards,<BR>
<BR>
Nico<BR>
</SPAN><SPAN STYLE='font-size:11pt'><BR>
<BR>
<BR>
On 11/02/09 20:19, "nico" <nico@crysto.org> wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="5"><FONT FACE="Times, Times New Roman"><SPAN STYLE='font-size:12pt'>Hi,<BR>
Sorry, i'm sending again this email because when i wrote the last, i didn't see it has been merged in another thread :-(<BR>
I'd like to send ack events to multiple BBDISPLAY.<BR>
<BR>
To do that, i did a change on hobbitserver.cfg with this configuration:<BR>
<BR>
<a href="http://www.hswn.dk/hobbiton/2005/10/msg00203.html">http://www.hswn.dk/hobbiton/2005/10/msg00203.html</a><BR>
<BR>
1) In hobbitserver.cfg on both display servers, after the BBDISPLAY<BR>
   setting add<BR>
        # For the enable/disable and acknowledge scripts.<BR>
        maint/BBDISP="0.0.0.0"<BR>
        maint/BBDISPLAYS="10.0.0.1 172.16.12.10"<BR>
   (replace with your display-server IP-adresses)<BR>
2) In hobbitcgi.cfg, change the line for the bb-ack.cgi tool:<BR>
        # bb-ack.cgi options<BR>
        CGI_ACK_OPTS="--area=maint<BR>
--env=/usr/lib/hobbit/server/etc/hobbitserver.cfg"<BR>
<BR>
The first problem is that it seems to not send acks events to the multiples<BR>
IP but only to local.<BR>
<BR>
The second problem is that when i modified BBDISP with the IP of another<BR>
hobbit server, we got an error:<BR>
<BR>
2009-02-11 17:02:52 Cookie 338777 not found, dropping ack<BR>
2009-02-11 17:06:34 Cookie 338777 not found, dropping ack<BR>
<BR>
The reason is that the cookie is different for the same host/test:<BR>
<BR>
serverA$ ${BB} ${BBSERVERIP}:${BBPORT} "hobbitdboard color=red,yellow<BR>
fields=hostname,testname,cookie"<BR>
cusaa-ws02|ftp|640796<BR>
<BR>
serverB$ ${BB} ${BBSERVERIP}:${BBPORT} "hobbitdboard color=red,yellow<BR>
fields=hostname,testname,cookie"<BR>
cusaa-ws02|ftp|338777<BR>
<BR>
We tried to disable cookie by adding "--no-cookies" into CGI_ACK_OPTS<BR>
variable of hobbitcgi.cfg but the problem still happens.<BR>
<BR>
Is there any way to fix it please ?<BR>
Thanks.<BR>
Regards,<BR>
nicolas<BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:9pt'><BR>
</SPAN></FONT><FONT SIZE="4"><FONT FACE="Lucida Grande"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>