Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(broker/neb): bad initializations fixed #1172

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion broker/neb/src/callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
26 changes: 20 additions & 6 deletions broker/neb/src/initial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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");

Expand All @@ -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) {
Expand All @@ -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.
Expand Down Expand Up @@ -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();
Expand Down
Loading