[hobbit] acknowledgment for a yellow alert doesn't seem to work

Henrik Stoerner henrik at hswn.dk
Fri Apr 8 07:40:37 CEST 2005


On Thu, Apr 07, 2005 at 05:22:26PM -0400, Daniel Deighton wrote:
> Something strange happened on my server.  It seems that a cookie expired
> after only 9 minutes (or less).  I've included the pertinent info below.
> What would cause this behavior?

OK, I think I've found the root cause of this issue, and it is
fundamentally a design flaw in how the cookies are generated.

Currently, a cookie is generated the moment a status changes from
green to yellow/red/purple, and gets a lifetime of 30 minutes. But the
cookie may not be delivered in an alert until some time after,
depending on any DURATION>x settings in the alert config - and by then
the cookie may be close to expiring. Combined with alerts only being
repeated every 30 minutes (by default), you can end up in a situation
where the cookie you get in the alert message will only be valid for a
minute or so.

The *real* solution is to change the cookie-generation so it happens
when the alert is sent out. That requires some serious changes to the
code - so I'll postpone that a bit and make that together with the
escalation-alert handling that is planned for 4.1.

So for now, the attached patch just changes the lifetime of a cookie
to 24 hours. That should make it work.


Regards,
Henrik
-------------- next part --------------
--- hobbitd/hobbitd.c	2005/04/03 15:44:07	1.136
+++ hobbitd/hobbitd.c	2005/04/08 05:36:29
@@ -909,7 +909,15 @@
 			} while (find_cookie(newcookie));
 
 			log->cookie = newcookie;
-			log->cookieexpires = log->validtime;
+
+			/*
+			 * This is fundamentally flawed. The cookie should be generated by
+			 * the alert module, because it may not be sent to the user for
+			 * a long time, depending on the alert configuration.
+			 * That's for 4.1 - for now, we'll just give it a long enough 
+			 * lifetime so that cookies will be valid.
+			 */
+			log->cookieexpires = 86400; /* Valid for 1 day */
 		}
 	}
 	else {
@@ -2014,6 +2022,12 @@
 					}
 				}
 			}
+			else {
+				errprintf("Cookie %d not found, dropping ack\n", cookie);
+			}
+		}
+		else {
+			errprintf("Bogus ack message from %s: '%s'\n", sender, msg->buf);
 		}
 
 		MEMUNDEFINE(durstr);


More information about the Xymon mailing list