From 3f8890c04c9c66d4f88dc30a885b3d8a23c90f13 Mon Sep 17 00:00:00 2001 From: David Boucher Date: Thu, 29 Feb 2024 22:28:14 +0100 Subject: [PATCH] fix(broker/neb): bad initializations fixed --- broker/neb/src/callbacks.cc | 1 - broker/neb/src/initial.cc | 26 ++++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/broker/neb/src/callbacks.cc b/broker/neb/src/callbacks.cc index 5df0ac9668a..1ea0091afbf 100644 --- a/broker/neb/src/callbacks.cc +++ b/broker/neb/src/callbacks.cc @@ -102,7 +102,6 @@ static struct { {NEBCALLBACK_COMMENT_DATA, &neb::callback_pb_comment}, {NEBCALLBACK_DOWNTIME_DATA, &neb::callback_pb_downtime}, {NEBCALLBACK_EXTERNAL_COMMAND_DATA, &neb::callback_pb_external_command}, - {NEBCALLBACK_HOST_CHECK_DATA, &neb::callback_host_check}, {NEBCALLBACK_HOST_CHECK_DATA, &neb::callback_pb_host_check}, {NEBCALLBACK_HOST_STATUS_DATA, &neb::callback_pb_host_status}, {NEBCALLBACK_PROGRAM_STATUS_DATA, &neb::callback_pb_program_status}, diff --git a/broker/neb/src/initial.cc b/broker/neb/src/initial.cc index ccdd30f696f..1b63674c185 100644 --- a/broker/neb/src/initial.cc +++ b/broker/neb/src/initial.cc @@ -124,7 +124,7 @@ static void send_pb_custom_variables_list() { /** * Send to the global publisher the list of downtimes. */ -static void send_downtimes_list() { +static void send_downtimes_list(neb_sender sender = neb::callback_downtime) { // Start log message. log_v2::neb()->info("init: beginning downtimes dump"); @@ -160,13 +160,20 @@ static void send_downtimes_list() { nsdd.downtime_id = p.second->get_downtime_id(); // Callback. - neb::callback_downtime(NEBCALLBACK_DOWNTIME_DATA, &nsdd); + sender(NEBCALLBACK_DOWNTIME_DATA, &nsdd); } // End log message. log_v2::neb()->info("init: end of downtimes dump"); } +/** + * Send to the global publisher the list of downtimes. + */ +static void send_pb_downtimes_list() { + send_downtimes_list(neb::callback_pb_downtime); +} + /** * Send to the global publisher the list of host dependencies within Nagios. */ @@ -320,7 +327,7 @@ static void send_pb_host_list() { /** * Send to the global publisher the list of host parents within Nagios. */ -static void send_host_parents_list() { +static void send_host_parents_list(neb_sender sender = neb::callback_relation) { // Start log message. log_v2::neb()->info("init: beginning host parents dump"); @@ -341,7 +348,7 @@ static void send_host_parents_list() { nsrd.dep_hst = it->second.get(); // Callback. - neb::callback_relation(NEBTYPE_PARENT_ADD, &nsrd); + sender(NEBTYPE_PARENT_ADD, &nsrd); } } } catch (std::exception const& e) { @@ -356,6 +363,13 @@ static void send_host_parents_list() { log_v2::neb()->info("init: end of host parents dump"); } +/** + * Send to the global publisher the list of host parents within Nagios. + */ +static void send_pb_host_parents_list() { + send_host_parents_list(neb::callback_pb_relation); +} + /** * Send to the global publisher the list of service dependencies within * Nagios. @@ -515,8 +529,8 @@ void neb::send_initial_pb_configuration() { send_pb_host_list(); send_pb_service_list(); send_pb_custom_variables_list(); - send_downtimes_list(); - send_host_parents_list(); + send_pb_downtimes_list(); + send_pb_host_parents_list(); send_pb_host_group_list(); send_pb_service_group_list(); send_pb_host_dependencies_list();