--- ./lib/acknowledgementslog.c.dist 2015-04-28 18:35:50.000000000 +0200 +++ ./lib/acknowledgementslog.c 2016-01-14 09:28:40.835846511 +0100 @@ -34,6 +34,7 @@ void *host; struct htnames_t *service; time_t eventtime; + time_t validity; char *recipient; char *message; struct acknowledgements_t *next; @@ -197,7 +198,10 @@ while (acknowledgementslog && (fgets(l, sizeof(l), acknowledgementslog))) { unsigned int etim; + unsigned int valid; + int duration; time_t eventtime; + time_t validity; char host[MAX_LINE_LEN]; char svc[MAX_LINE_LEN]; char recipient[MAX_LINE_LEN]; @@ -210,11 +214,11 @@ int ovector[30]; /* 2015-03-07 18:17:03 myserver disk andy 1 1425724570 1425752223 1425838623 testing message */ - itemsfound = sscanf(l, "%*u-%*u-%*u %*u:%*u:%*u %s %s %s %*u %*u %u %*u %[^\t\n]", host, svc, recipient, &etim, message); - if (itemsfound != 5) { + itemsfound = sscanf(l, "%*u-%*u-%*u %*u:%*u:%*u %s %s %s %*u %*u %u %u %[^\t\n]", host, svc, recipient, &etim, &valid, message); + if (itemsfound != 6) { /* 1430040985 630949 30 630949 np_filename_not_used myserver.procs red testing log format \nAcked by: andy (127.0.0.1) */ - itemsfound = sscanf(l, "%u\t%*u\t%*u\t%*u\tnp_filename_not_used\t%s\t%*s\t%[^\n]", &etim, host, message); - if (itemsfound != 3) continue; + itemsfound = sscanf(l, "%u\t%*u\t%d\t%*u\tnp_filename_not_used\t%s\t%*s\t%[^\n]", &etim, &duration, host, message); + if (itemsfound != 4) continue; p = strrchr(host, '.'); if (p) { *p = '\0'; @@ -235,6 +239,12 @@ if (eventtime < firstevent) continue; if (eventtime > lastevent) break; + if (duration) { + validity = etim + duration * 60; + } else { + validity = valid; + } + hostname = host; svcname = svc; eventhost = hostinfo(hostname); if (!eventhost) continue; /* Dont report hosts that no longer exist */ @@ -318,6 +328,7 @@ newrec->host = eventhost; newrec->service = eventcolumn; newrec->eventtime = eventtime; + newrec->validity = validity; newrec->recipient = strdup(recipient); newrec->message = strdup(message); newrec->next = head; @@ -349,8 +360,8 @@ fprintf(output, "

\n"); fprintf(output, "\n"); fprintf(output, "\n"); - fprintf(output, "\n", htmlquoted(title)); - fprintf(output, "\n"); + fprintf(output, "\n", htmlquoted(title)); + fprintf(output, "\n"); for (walk=head; (walk != lasttoshow->next); walk=walk->next) { char *hostname = xmh_item(walk->host, XMH_HOSTNAME); @@ -359,6 +370,7 @@ bgcolor = ((bgcolor + 1) % 2); fprintf(output, "\n", ctime(&walk->eventtime)); + fprintf(output, "\n", ctime(&walk->validity)); fprintf(output, "\n", hostname); fprintf(output, "\n", walk->service->name);
%s
TimeHostServiceAcknowledged ByMessage
%s
TimeValid UntilHostServiceAcknowledged ByMessage
%s%s%s%s