Xymon Mailing List Archive search

Remedy Ticketing

list Matthew Epp
Fri, 25 Aug 2006 13:17:22 -0400
Message-Id: <user-c117a8c6b9b6@xymon.invalid>

I'm slightly confused about what you did. The *current* status page
(which is where you have a "History" button) doesn't have a "timebuf"
value, because it's just the current status - and it might not be logged
in the historical logs directory.
In the old Big Brother system, $BBVAR/logs contained a file for every
current status page. So, in the dohostsvc.c I did:

logtime = (char *) getenv("LOGTIME");

Then the cgi script checked to see if it was a current page or a historical
one:  ($TIMEBUF is the value of logtime passed to the cgi script) 

    if [ "$TIMEBUF" != "LOGTIME_not_set" ]; then
 
      HOSTLOG=`echo $HOST | $SED 's/,/_/g'`
 
      # get the color of the status from the status file
      set `$CAT "$BBHISTLOGS/$HOSTLOG/$SERVICE/$TIMEBUF" | $HEAD -1`
/dev/null 2>&1
      BKG="$1"
      # Grab the status page from histlogs
      ALERTDATA=`$CAT $BBHISTLOGS/$HOSTLOG/$SERVICE/$TIMEBUF`
    else
      # Grab the current status page
      set `$CAT "$BBLOGS/$HOSTSVC" | $HEAD -1` >/dev/null 2>&1
      BKG="$1"
 
      ALERTDATA=`$CAT $BBLOGS/$HOSTSVC`
    fi
 
On the other hand, a *historical* status log page doesn't have a
"History" button because ... well, you're already looking at history.

If you can work it out yourself, then you probably need the "logtime"
parameter for the generate_html_log() routine. This has the Unix
timestamp of the log entry. If you need to convert the timestamp into
the filename format used by the historical logs, "histlogtime(timestamp);"
will return a string with the correct formatting of the timestamp.
Does a current status page get saved anywhere to a file in Hobbit like Big
Brother did? I need some way to pass the data to the cgi script for parsing.