[Nagios-devel] Suggested patch for timeperiod daterange problem

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Suggested patch for timeperiod daterange problem

Post by Guest »

Since we started using "day 1 - -1" in timeperiod objects a
few months back we've experienced problems on the last day of
each month with checks and notifications not occurring.

The problem seems to be in base/utils.c:

--- base/utils.c.original 2008-03-10 13:58:33.000000000 -0700
+++ base/utils.c 2008-05-31 15:45:09.000000000 -0700
@@ -1523,7 +1523,7 @@
/* make the new time */
t.tm_mon=month;
t.tm_year=year;
- t.tm_mday+=(monthday<-30)?-30:monthday;
+ t.tm_mday+=(monthday<-30)?-30:monthday+1;
midnight=mktime(&t);

/* if we rolled over to the previous month, time is invalid */

On entry into the above code, t.tm_mday is the last day of the month.
Adding a monthday of -1 changes t.tm_mday to the day before the last
day of the month, but -1 is supposed to mean the last day of the month.
Therefore we have to add +1 to compensate.

(The above patch is against version 3.0.1 via Debian.)

--Mike Bird





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked