Xymon Mailing List Archive search

Mailack delay problems

list Johan Sjöberg
Fri, 18 Feb 2011 11:46:26 +0100
Message-Id: <user-d23af97b2923@xymon.invalid>

Hi.

I have tested this a little more. The delay argument is not read when the hostname.test part of the subject is too long.
A customer acked an alert with this subject " RE: Xymon [889690]  xxxxxx02.xxx.deltamanagement.se.tomcat_mem red delay=5h", but it was only acked for 1h, and the ack log shows that too:

1298025175      889690  60      889690  np_filename_not_used    xxxxxxx02.xxx.deltamanagement.se.tomcat_mem    red     --_005_AE4BD8B214BCA940BFCE8A124A01D95A2A2EB323F0EXCHANGE07lan_\nAcked by: xxxxxxxxxxx

But I think the problem is procmail, because I can't see the delay parameter in the procmail log either:

From xxxxxxxxxxx  Fri Feb 18 11:32:55 2011
 Subject: RE: Xymon [889690] xxxxxxx02.xxx.deltamanagement.se.tomcat_mem red
  Folder: /usr/local/xymon/server/bin/xymon-mailack --env=/usr/local/x    11364

So then I tried adding a lot of extra characters in the hostname, and then even that was gone in the procmail log:

From xxxxxxxxx  Fri Feb 18 11:41:50 2011
 Subject: RE: Xymon [889690]
  Folder: /usr/local/xymon/server/bin/xymon-mailack --env=/usr/local/x     4105

So I will try to fix this in procmail

/Johan


-----Original Message-----
From: Henrik Størner [mailto:user-ce4a2c883f75@xymon.invalid] 
Sent: den 7 februari 2011 13:27
To: xymon at xymon.com
Subject: Re: [xymon] RE: Mailack delay problems

Hi Johan

In <user-888445fd5188@xymon.invalid> =?iso-8859-1?Q?Johan_Sj=F6berg?= <user-74c177c1220d@xymon.invalid> writes:
I tested on another alert now, and it works if I remove the unnecessary 
par= ts of the subject, for example if I change it to "Re: Hobbit 
[455503] delay= =3D600". So maybe it's the subject that is too long or 
something when it is=  not working.
It's possible, but your subject line would have to be very long for this to fail - longer than 1 KB. Sounds a bit odd if that is really the case.

The attached diff removes this restriction, so if this solves the problem I would like to know. I'll probably do this change anyway, since it is a bit silly to have these random limits.


Regards,
Henrik

Index: xymond/xymon-mailack.c
===================================================================
--- xymond/xymon-mailack.c	(revision 6631)
+++ xymond/xymon-mailack.c	(working copy)
@@ -68,8 +68,8 @@
 			else if ((strncasecmp(STRBUF(inbuf), "ack=", 4) == 0) || (strncasecmp(STRBUF(inbuf), "ack ", 4) == 0)) {
 				/* Some systems cannot generate a subject. Allow them to ack
 				 * via text in the message body. */
-				subjectline = (char *)malloc(1024);
-				snprintf(subjectline, 1023, "Subject: Xymon [%s]", STRBUF(inbuf)+4);
+				subjectline = (char *)malloc(STRBUFLEN(inbuf) + 1024);
+				sprintf(subjectline, "Subject: Xymon [%s]", STRBUF(inbuf)+4);
 			}
 			else if (*STRBUF(inbuf) && !firsttxtline) {
 				/* Save the first line of the message body, but ignore blank lines */