diff --git a/Changelog b/Changelog index 1e1bd9e2..8dd26fec 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,18 @@ Nagios Core 4 Change Log ######################## +4.4.2 - ?????????? +------------------ +FIXES +* Fix comment data being duplicated after a `service nagios reload` or similar (Bryan Heden) +* Fix check_interval and retry_interval not changing at the appropriate times (Scott Wilkerson) +* Fixed passive checks sending recovery email when host was previously UP (Scott Wilkerson) +* Fixed flapping comments duplication on nagios reload (Christian Jung) +* Fix for CVE-2018-13441, CVE-2018-13458, CVE-2018-13457 null pointer dereference (Trevor McDonald) +* Fixed syntax error in file: default-init.in (#558) (Christian Zettel) +* Reset current notification number and state flags when the host recovers, reset all service variables when they recover fixes (#557) (Scott Wilkerson) +* Fixed wrong counting of service status totals when showing servicegroup details (#548) (Christian Zettel, Bryan Heden) + 4.4.1 - 2018-06-25 ------------------ FIXES diff --git a/base/checks.c b/base/checks.c index 725dec9d..d45b6ac4 100644 --- a/base/checks.c +++ b/base/checks.c @@ -911,6 +911,11 @@ static inline void service_state_or_hard_state_type_change(service * svc, int st if (state_or_type_change) { + /* check if service should go into downtime from flexible downtime */ + if (svc->pending_flex_downtime > 0) { + check_pending_flex_service_downtime(svc); + } + /* reset notification times and suppression option */ svc->last_notification = (time_t)0; svc->next_notification = (time_t)0; @@ -941,7 +946,10 @@ static inline void host_state_or_hard_state_type_change(host * hst, int state_ch log_debug_info(DEBUGL_CHECKS, 2, "Check type passive and passive host checks aren't false\n"); - hst->current_attempt = 1; + if (state_change == TRUE) { + hst->current_attempt = 1; + } + hard_state_change = TRUE; } @@ -989,6 +997,9 @@ static inline void host_state_or_hard_state_type_change(host * hst, int state_ch if (state_or_type_change) { + /* check if host should go into downtime from flexible downtime */ + check_pending_flex_host_downtime(hst); + /* reset notification times and suppression option */ hst->last_notification = (time_t)0; hst->next_notification = (time_t)0; @@ -1228,7 +1239,7 @@ int handle_async_service_check_result(service *svc, check_result *cr) next_check = (time_t)(svc->last_check + (svc->check_interval * interval_length)); /***********************************************/ - /********** SCHEDULE HOST CHECK LOGIC **********/ + /********** SCHEDULE SERVICE CHECK LOGIC **********/ /***********************************************/ if (svc->current_state == STATE_OK) { @@ -1269,6 +1280,7 @@ int handle_async_service_check_result(service *svc, check_result *cr) svc->host_problem_at_last_check = TRUE; } + } else { @@ -1368,6 +1380,9 @@ int handle_async_service_check_result(service *svc, check_result *cr) else { log_debug_info(DEBUGL_CHECKS, 1, "Service is a non-OK state (%s)!", service_state_name(svc->current_state)); + + svc->state_type = SOFT_STATE; + svc->current_attempt = 1; handle_event = TRUE; } @@ -1395,6 +1410,21 @@ int handle_async_service_check_result(service *svc, check_result *cr) log_debug_info(DEBUGL_CHECKS, 1, "Service experienced a SOFT recovery.\n"); } + + + /* reset all service variables because its okay now... */ + svc->host_problem_at_last_check = FALSE; + svc->current_attempt = 1; + svc->state_type = HARD_STATE; + svc->last_hard_state = STATE_OK; + svc->last_notification = (time_t)0; + svc->next_notification = (time_t)0; + svc->current_notification_number = 0; + svc->problem_has_been_acknowledged = FALSE; + svc->acknowledgement_type = ACKNOWLEDGEMENT_NONE; + svc->notified_on = 0; + + hard_state_change = TRUE; } /***** SERVICE IS STILL IN PROBLEM STATE *****/ @@ -1418,6 +1448,14 @@ int handle_async_service_check_result(service *svc, check_result *cr) } } } + + /* soft states should be using retry_interval */ + if (svc->state_type == SOFT_STATE) { + + log_debug_info(DEBUGL_CHECKS, 2, "Service state type is soft, using retry_interval\n"); + + next_check = (unsigned long) (current_time + svc->retry_interval * interval_length); + } /* check for a state change */ if (svc->current_state != svc->last_state || (svc->current_state == STATE_OK && svc->state_type == SOFT_STATE)) { @@ -1454,6 +1492,8 @@ int handle_async_service_check_result(service *svc, check_result *cr) if (svc->current_attempt >= svc->max_attempts && svc->current_state != svc->last_hard_state) { log_debug_info(DEBUGL_CHECKS, 2, "Service had a HARD STATE CHANGE!!\n"); + + next_check = (unsigned long)(current_time + (svc->check_interval * interval_length)); hard_state_change = TRUE; @@ -2197,6 +2237,9 @@ int handle_async_host_check_result(host *hst, check_result *cr) else { log_debug_info(DEBUGL_CHECKS, 1, "Host is no longer UP (%s)!\n", host_state_name(hst->current_state)); + + hst->state_type = SOFT_STATE; + hst->current_attempt = 1; /* propagate checks to immediate parents if they are UP */ host_propagate_checks_to_immediate_parents(hst, FALSE, current_time); @@ -2276,7 +2319,9 @@ int handle_async_host_check_result(host *hst, check_result *cr) if (hst->current_state != HOST_UP && (hst->check_type == CHECK_TYPE_ACTIVE || translate_passive_host_checks == TRUE)) { hst->current_state = determine_host_reachability(hst); - next_check = (unsigned long)(current_time + (hst->retry_interval * interval_length)); + if (hst->state_type == SOFT_STATE) + next_check = (unsigned long)(current_time + (hst->retry_interval * interval_length)); + } /* check for state change */ @@ -2310,7 +2355,9 @@ int handle_async_host_check_result(host *hst, check_result *cr) log_debug_info(DEBUGL_CHECKS, 2, "Host had a HARD STATE CHANGE!!\n"); - hard_state_change = TRUE; + next_check = (unsigned long)(current_time + (hst->check_interval * interval_length)); + + hard_state_change = TRUE; send_notification = TRUE; } @@ -2372,6 +2419,12 @@ int handle_async_host_check_result(host *hst, check_result *cr) } } + /* the host recovered, so reset the current notification number and state flags (after the recovery notification has gone out) */ + if(hst->current_state == HOST_UP && hst->state_type == HARD_STATE && hard_state_change == TRUE) { + hst->current_notification_number = 0; + hst->notified_on = 0; + } + if (obsess_over_hosts == TRUE) { obsessive_compulsive_host_check_processor(hst); } diff --git a/base/nagios.c b/base/nagios.c index 520ba71e..24719647 100644 --- a/base/nagios.c +++ b/base/nagios.c @@ -878,6 +878,9 @@ int main(int argc, char **argv) { /* clean up the scheduled downtime data */ cleanup_downtime_data(); + /* clean up comment data */ + free_comment_data(); + /* clean up the status data if we are not restarting */ if(sigrestart == FALSE) { cleanup_status_data(TRUE); diff --git a/cgi/status.c b/cgi/status.c index 20c4ed48..8b1c8b31 100644 --- a/cgi/status.c +++ b/cgi/status.c @@ -873,6 +873,11 @@ void show_service_status_totals(void) { count_service = 1; } else if(display_type == DISPLAY_SERVICEGROUPS) { + + if (is_service_member_of_servicegroup(find_servicegroup(servicegroup_name), temp_service) == FALSE) { + continue; + } + if(show_all_servicegroups == TRUE) { count_service = 1; }