Xymon Mailing List Archive search

Mailack delay problems

4 messages in this thread

list Johan Sjöberg · Wed, 26 Jan 2011 10:18:49 +0100 ·
Hi.

I think there is some problem with the mailack delay parameter in 4.3.0RC1. This night I got an alert, and I wanted to ack it from my mobile phone. I hit reply and added "delay=600" to the subject line. I can see in my sent folder that the subject is correct. But after an hour I got another SMS for the same service, so it seems like it did not accept the parameter correctly.

E-mail subject: "Ang.: Hobbit [455503] hostname.removed.svcs red delay=600"

Procmail.log:
From my at email  Wed Jan 26 04:43:39 2011
Subject: Ang.: Hobbit [455503] hostname.removed.svcs
  Folder: /usr/local/xymon/server/bin/hobbit-mailack --env=/usr/local/    12506

Acknowledge.log:
1296013419      455503  60      455503  np_filename_not_used    hostname.removed.svcs   red     --_000_5D50DE4ACDBB4C018A9302A181625CBFdeltamanagementse_\nAcked by: =?iso-8859-1?Q?Johan_Sj=F6berg?=  my at email

Or is procmail the problem, since the delay=600 is not in the subject of the procmail.log?
The hostname is quite long, which means the subject is long. Could that be a problem?
By the way, does mailack now accept "Xymon [ackcode]" so I can change the subject of the alerts from Hobbit?

/Johan
list Johan Sjöberg · Wed, 26 Jan 2011 11:20:14 +0100 ·
I tested on another alert now, and it works if I remove the unnecessary parts of the subject, for example if I change it to "Re: Hobbit [455503] delay=600". So maybe it's the subject that is too long or something when it is not working.

/Johan
quoted from Johan Sjöberg

From: Johan Sjöberg [mailto:user-74c177c1220d@xymon.invalid]
Sent: den 26 januari 2011 10:19
To: xymon at xymon.com
Subject: [xymon] Mailack delay problems

Hi.

I think there is some problem with the mailack delay parameter in 4.3.0RC1. This night I got an alert, and I wanted to ack it from my mobile phone. I hit reply and added "delay=600" to the subject line. I can see in my sent folder that the subject is correct. But after an hour I got another SMS for the same service, so it seems like it did not accept the parameter correctly.

E-mail subject: "Ang.: Hobbit [455503] hostname.removed.svcs red delay=600"

Procmail.log:
From my at email  Wed Jan 26 04:43:39 2011
Subject: Ang.: Hobbit [455503] hostname.removed.svcs
  Folder: /usr/local/xymon/server/bin/hobbit-mailack --env=/usr/local/    12506

Acknowledge.log:
1296013419      455503  60      455503  np_filename_not_used    hostname.removed.svcs   red     --_000_5D50DE4ACDBB4C018A9302A181625CBFdeltamanagementse_\nAcked by: =?iso-8859-1?Q?Johan_Sj=F6berg?=  my at email

Or is procmail the problem, since the delay=600 is not in the subject of the procmail.log?
The hostname is quite long, which means the subject is long. Could that be a problem?
By the way, does mailack now accept "Xymon [ackcode]" so I can change the subject of the alerts from Hobbit?

/Johan
list Henrik Størner · Mon, 7 Feb 2011 12:26:30 +0000 (UTC) ·
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 */
list Johan Sjöberg · Fri, 18 Feb 2011 11:46:26 +0100 ·
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
quoted from Henrik Størner


-----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 */