[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] "Stop after" not shown in the Info-Page
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] "Stop after" not shown in the Info-Page
- From: Henrik =?unknown-8bit?q?St=C3=B8rner?= <henrik (at) hswn.dk>
- Date: Thu, 4 Dec 2008 14:07:11 +0100
- References: <1226702319.11679.13.camel (at) mcdonalddj-dc.austin-energy.net> <7F79BACB04DFE04A9364D9CC9C9632BA02295555 (at) edusm02.education.vic.gov.au> <491EBA92.8060509 (at) bakarasse.de> <4921F1D7.5030800 (at) bakarasse.de>
- User-agent: Mutt/1.5.18 (2008-05-17)
On Mon, Nov 17, 2008 at 11:36:07PM +0100, Alexander Bech wrote:
> Alexander Bech schrieb:
>> Hi,
>>
>> i have configured alerts in hobbit-alerts.cfg:
>>
>> HOST=%.*
>> MAIL recipient (at) company.examle DURATION>3 DURATION<10 REPEAT=1
>>
>> This works fine.
>> Hobbit sent me 7 mails after 3 minutes each minute and after that no
>> more.
>>
>> But i can't see anything in the "Stop after" column in the info-page.
>>
>>
> I have found the bug (?) in loadalerts.c in the line 1081 (-less
> than/+greater than):
> - if (recip->criteria && recip->criteria->maxduration &&
> (recip->criteria->maxduration < maxdur)) ...
> + if (recip->criteria && recip->criteria->maxduration &&
> (recip->criteria->maxduration > maxdur)) ...
I'm afraid that was not the correct solution. This fails if you have
DURATION settings on the HOST entry as well as the MAIL entry. The
correct solution is quite different - patch attached, this is also
going into the 4.2.2 version.
Regards,
Henrik
Index: lib/loadalerts.c
===================================================================
--- lib/loadalerts.c (revision 6016)
+++ lib/loadalerts.c (revision 6019)
@@ -1075,9 +1075,19 @@
addtobuffer(buf, l);
}
- if (printrule->criteria) mindur = printrule->criteria->minduration;
+ /*
+ * The min/max duration of an alert can be controlled by both the actual rule,
+ * and by the recipient specification.
+ * The rule must be fulfilled before the recipient even gets into play, so
+ * if there is a min/max duration on the rule then this becomes the default
+ * and recipient-specific settings can only increase the minduration/decrease
+ * the maxduration.
+ * On the other hand, if there is no rule-setting then the recipient-specific
+ * settings determine everything.
+ */
+ if (printrule->criteria && printrule->criteria->minduration) mindur = printrule->criteria->minduration;
if (recip->criteria && recip->criteria->minduration && (recip->criteria->minduration > mindur)) mindur = recip->criteria->minduration;
- if (printrule->criteria) maxdur = printrule->criteria->maxduration;
+ if (printrule->criteria && printrule->criteria->maxduration) maxdur = printrule->criteria->maxduration;
if (recip->criteria && recip->criteria->maxduration && (recip->criteria->maxduration < maxdur)) maxdur = recip->criteria->maxduration;
if (printrule->criteria && printrule->criteria->timespec) timespec = printrule->criteria->timespec;
if (recip->criteria && recip->criteria->timespec) {