Xymon Mailing List Archive search

Acknowledge Alert web page - patch for durations

2 messages in this thread

list Heather Keen · Tue, 5 Jul 2011 12:43:38 +0100 ·
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
list Henrik Størner · Mon, 01 Aug 2011 18:03:49 +0200 ·
quoted from Heather Keen
On 05-07-2011 13:43, Heather Keen wrote:
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.
Applied for 4.3.4.


Regards,
Henrik