Xymon Mailing List Archive search

BB-Hosts DOWNTIME

list Dominique Frise
Wed, 29 Apr 2009 15:37:23 +0200
Message-Id: <user-356034e7db53@xymon.invalid>

Patrick Nixon wrote:
I'd have to agree to that.

On my info page for the previously provided downtime, I have:

Planned Downtime: cam:60:0000:2400:Offline2, cam:W:1930:0830:Offline

Doesn't seem to be parsing it properly, but it does work appropriately.

On Tue, Apr 28, 2009 at 3:16 PM, Rob McBroom <user-371ba9bb5b75@xymon.invalid> wrote:
On 2009-Apr-28, at 1:05 PM, user-ab09d151b26b@xymon.invalid wrote:
I have just changed my BB-HOsts to reflect the following....I have a
suspision that my issue was with letting bb-hosts get regnerated before i
come to a conclusion of it not working..

BB-HOSTS entry = DOWNTIME=*:1000:1100

The information page shows the following

Planned downtime:All days:1000:1100
In my experience, the syntax that makes the information page look correct is
not the syntax that will actually work. I'm guessing the code that parses
the DOWNTIME option was duplicated in two places and those two places are
now out of sync.

--
Rob McBroom
<http://www.skurfer.com/>;

Yes, I also do agree with this!
BTW, this was already spotted in
http://www.hswn.dk/hobbiton/2008/05/msg00042.html


After digging into the code, I found 2 issues around the DOWNTIME behaviour.

1. Internal handling of DOWNTIME values do not reflect the specification 
of the  bb-hosts(5) man page.

The man page says: 
DOWNTIME=[columns:]day:starttime:endtime:cause[,day:starttime:endtime:cause]

But the check_downtime function code in lib/timefunc.c says:
---- extract of ./lib/timefunc.c ----
...
    303                  do {
    304                          /* Its either DAYS:START:END or 
SERVICE:DAYS:START:END:CAUSE */
    305
    306                          s1 = p; p += strcspn(p, ":"); if (*p != 
'\0') { *p = '\0'; p++; }
    307                          s2 = p; p += strcspn(p, ":"); if (*p != 
'\0') { *p = '\0'; p++; }
...

According to this, the man page should say:
DOWNTIME=day:starttime:endtime:[,day:starttime:endtime]
	OR
DOWNTIME=columns:day:starttime:endtime:cause[,columns,day:starttime:endtime:cause]

2. The "Planned Downtime" line displayed in info column do not honor the 
optional "columns" tag at all. The generate_info function in 
./web/hobbitsvc-info.c calls the timespec_text function that handles 
day:starttime:endtime values only. (like REPORTTIME).

------------- extract of /web/hobbitsvc-info.c---------
    871          val = bbh_item(hostwalk, BBH_DOWNTIME);
    872          if (val) {
    873                  char *s = timespec_text(val);
    874                  addtobuffer(infobuf, "<tr><th 
align=left>Planned downtime:</th><td align=left>");
    875                  addtobuffer(infobuf, s);
    876                  addtobuffer(infobuf, "</td></tr>\n");
    877          }

There is no quick hacks to solve both problems :-(
I think only the boss -Henrik- can make the appropriate redesign/changes.

Dominique