[hobbit] hobbitd_alert crashes
Dominique Frise
Dominique.Frise at unil.ch
Sat Jun 3 11:03:26 CEST 2006
Henrik Stoerner wrote:
> On Fri, Jun 02, 2006 at 08:19:10AM +0200, Dominique Frise wrote:
>
>
>>Looking at the event log, I noticed that the 3 times that hobbitd_alert
>>crashed, it was trying to send to an IGNORE recipient (not always the same).
>
>
> Thanks, it was easy to reproduce the problem once I tried some IGNORE
> rules. I believe this patch should solve the problem.
>
>
> Regards,
> Henrik
>
>
>
> ------------------------------------------------------------------------
>
> --- hobbitd/do_alert.c 2006/05/28 15:16:51 1.91
> +++ hobbitd/do_alert.c 2006/06/02 11:12:17
> @@ -88,6 +88,8 @@
> char *id, *method = "unknown";
> repeat_t *walk;
>
> + if (recip->method == M_IGNORE) return NULL;
> +
> switch (recip->method) {
> case M_MAIL: method = "mail"; break;
> case M_SCRIPT: method = "script"; break;
> @@ -325,6 +327,8 @@
> * might create here is NOT used later on.
> */
> rpt = find_repeatinfo(alert, recip, 1);
> + if (!rpt) continue; /* Happens for e.g. M_IGNORE recipients */
> +
> dprintf(" repeat %s at %d\n", rpt->recipid, rpt->nextalert);
> if (rpt->nextalert > now) {
> traceprintf("Recipient '%s' dropped, next alert due at %d > %d\n",
> --- lib/loadalerts.c 2006/05/31 08:50:03 1.13
> +++ lib/loadalerts.c 2006/06/02 11:19:36
> @@ -1092,7 +1092,9 @@
> (recip->criteria && (recip->criteria->sendnotice == SR_WANTED)) ) notice = 1;
>
> *codes = '\0';
> - if (recip->method == M_IGNORE) strcat(codes, "I");
> + if (recip->method == M_IGNORE) {
> + recip->recipient = "-- ignored --";
> + }
> if (recip->noalerts) { if (strlen(codes)) strcat(codes, ",A"); else strcat(codes, "-A"); }
> if (recovered && !recip->noalerts) { if (strlen(codes)) strcat(codes, ",R"); else strcat(codes, "R"); }
> if (notice) { if (strlen(codes)) strcat(codes, ",N"); else strcat(codes, "N"); }
>
>
>
> ------------------------------------------------------------------------
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
We did not have any new crash since we applied the patches :-)
Thank you.
Dominique
UNIL - University of Lausanne
More information about the Xymon
mailing list