Skip to content

Commit

Permalink
Fix [#595}: Scheduled downtime bugs (#1004)
Browse files Browse the repository at this point in the history
* Handle case when a downtime is both flex and triggered

* Add more conditions that check when a downtime should start immediately
  • Loading branch information
tsadpbb authored Nov 15, 2024
1 parent f6f417e commit efa56d2
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 198 deletions.
4 changes: 4 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Nagios Core 4 Change Log
########################

4.5.8 - 2024-XX-XX
------------------
* Fix issues with downtimes that are both flexible and triggered and improve downtime additions in general (#595) (Dylan Anderson)

4.5.7 - 2024-10-24
------------------
* Expand the custom variable macros to an empty string, if the custom variable does not exist (Andre Klärner)
Expand Down
18 changes: 15 additions & 3 deletions base/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,13 +1300,25 @@ int handle_timed_event(timed_event *event) {
update_all_status_data();
break;

case EVENT_SCHEDULED_DOWNTIME:
case EVENT_SCHEDULED_DOWNTIME_START:

log_debug_info(DEBUGL_EVENTS, 0, "** Scheduled Downtime Event. Latency: %.3fs\n", latency);
log_debug_info(DEBUGL_EVENTS, 0, "** Scheduled Downtime Start Event. Latency: %.3fs\n", latency);

/* process scheduled downtime info */
if(event->event_data) {
handle_scheduled_downtime_by_id(*(unsigned long *)event->event_data);
handle_scheduled_downtime_start_by_id(*(unsigned long *)event->event_data);
free(event->event_data);
event->event_data = NULL;
}
break;

case EVENT_SCHEDULED_DOWNTIME_END:

log_debug_info(DEBUGL_EVENTS, 0, "** Scheduled Downtime End Event. Latency: %.3fs\n", latency);

/* process scheduled downtime info */
if(event->event_data) {
handle_scheduled_downtime_end_by_id(*(unsigned long *)event->event_data);
free(event->event_data);
event->event_data = NULL;
}
Expand Down
Loading

0 comments on commit efa56d2

Please sign in to comment.