Skip to content

Commit

Permalink
enh(broker): all bbdo events are translated to protobuf
Browse files Browse the repository at this point in the history
REFS: MON-24655
  • Loading branch information
bouda1 authored Mar 1, 2024
1 parent e7f9c56 commit c17f14f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
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

1 comment on commit c17f14f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
6 1 0 7 85.71 0s

Failed Tests

Name Message ⏱️ Duration Suite
BENCH_10000STATUS AttributeError: 'NoneType' object has no attribute 'query_read_bytes' 0.000 s Bench

Please sign in to comment.