[Xymon] Acknowledge Alert web page - patch for durations
Heather Keen
keenha at googlemail.com
Tue Jul 5 13:43:38 CEST 2011
Hi all,
For anyone that is interested ... I've written a patch for the Acknowledge
Alert page so that you can select a duration in mins, hours or days (for
those of us who have long term problems!). Thought I'd share it with y'all.
Apply to v4.3.3 web/acknowledge.c:
15a16,19
>
/*----------------------------------------------------------------------------------*/
> /* Edited by Heather Keen 2011/06/29, to add different period types to ACK
duration.*/
>
/*----------------------------------------------------------------------------------*/
>
36a41
> char *period;
44a50
> char *periodall = NULL;
76c82
< char *acknum = NULL, *validity = NULL, *ackmsg = NULL;
---
> char *acknum = NULL, *validity = NULL, *ackmsg = NULL,
*period = NULL;
86a93,95
> else if (strcasecmp(cwalk->name, "PERIOD_all") == 0) {
> if (*cwalk->value) periodall = cwalk->value;
> }
93a103,106
> else if (strncasecmp(cwalk->name, "PERIOD", 5) == 0) {
> if (*cwalk->value) period = cwalk->value;
> delim = strchr(cwalk->name, '_'); if (delim) id =
atoi(delim+1);
> }
139a153
> if (period) awalk->period = strdup(period);
164c178,179
< fprintf(output, " <TD><INPUT TYPE=TEXT NAME=\"DELAY_%s\" SIZE=8
MAXLENGTH=20></TD>\n", numstr);
---
> fprintf(output, " <TD NOWRAP><INPUT TYPE=TEXT NAME=\"DELAY_%s\"
SIZE=4 MAXLENGTH=6><SELECT NAME=\"PERIOD_%s\"><OPTION VALUE=min
SELECTED>min(s)<OPTION VALUE=hour>hour(s)<OPTION
VALUE=day>day(s)</SELECT></TD>\n", numstr, numstr);
>
275c290
< fprintf(stdout,
"<tr><th align=left>Host</th><th align=left>Test</th><th
align=left>Duration<br>(minutes)</th><th
align=left>Cause</th><th>Ack</th><th>Ack Multiple</tr>\n");
---
> fprintf(stdout,
"<tr><th align=left>Host</th><th align=left>Test</th><th
align=left>Duration</th><th align=left>Cause</th><th>Ack</th><th>Ack
Multiple</tr>\n");
326a342
> if (periodall) awalk->period = periodall;
328a345,347
> if (strncmp(awalk->period, "hour", 4) == 0)
awalk->validity *= 60;
> else if (strncmp(awalk->period, "day", 4) == 0)
awalk->validity *= 60*24;
>
Regards,
Heather
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20110705/2f4ad8c1/attachment.html>
More information about the Xymon
mailing list