diff --git a/bbdo/events.hh b/bbdo/events.hh index 95e9d48b39a..d43972d4cab 100644 --- a/bbdo/events.hh +++ b/bbdo/events.hh @@ -149,6 +149,7 @@ enum data_element { de_pb_service_group = 51, de_pb_service_group_member = 52, de_pb_host_parent = 53, + de_pb_instance_configuration = 54 }; } // namespace neb namespace storage { diff --git a/bbdo/neb.proto b/bbdo/neb.proto index f8a1b5a6cff..475f39a94a8 100644 --- a/bbdo/neb.proto +++ b/bbdo/neb.proto @@ -733,3 +733,10 @@ message HostParent { uint64 child_id = 3; uint64 parent_id = 4; } + +/*io::neb, neb::de_pb_instance_configuration*/ +message InstanceConfiguration { + BBDOHeader header = 1; + bool loaded = 2; + uint64 poller_id = 3; +} diff --git a/broker/CMakeLists.txt b/broker/CMakeLists.txt index fb4287d2e68..e8a2c1f1ddc 100644 --- a/broker/CMakeLists.txt +++ b/broker/CMakeLists.txt @@ -103,7 +103,8 @@ add_custom_command( COMMAND ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out="${SRC_DIR}" --proto_path=${SRC_DIR} --proto_path=${CMAKE_SOURCE_DIR}/common/src - ${SRC_DIR}/broker.proto) + ${SRC_DIR}/broker.proto + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_custom_target("target_broker_message" DEPENDS "${SRC_DIR}/broker.pb.cc" "${SRC_DIR}/broker.pb.h") diff --git a/broker/grpc/CMakeLists.txt b/broker/grpc/CMakeLists.txt index e715900d77b..93f38d29c09 100644 --- a/broker/grpc/CMakeLists.txt +++ b/broker/grpc/CMakeLists.txt @@ -107,7 +107,8 @@ add_custom_command( --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} --proto_path=${MODULE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/bbdo grpc_stream.proto - VERBATIM) + VERBATIM + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) # Testing. if(WITH_TESTING) diff --git a/broker/neb/inc/com/centreon/broker/neb/internal.hh b/broker/neb/inc/com/centreon/broker/neb/internal.hh index 3578a5d726e..79e05061537 100644 --- a/broker/neb/inc/com/centreon/broker/neb/internal.hh +++ b/broker/neb/inc/com/centreon/broker/neb/internal.hh @@ -123,6 +123,9 @@ using pb_service_group_member = make_type(io::neb, neb::de_pb_service_group_member)>; using pb_host_parent = io::protobuf; +using pb_instance_configuration = + io::protobuf; } // namespace neb diff --git a/broker/neb/src/broker.cc b/broker/neb/src/broker.cc index a73f994e893..5bbd5eb57d9 100644 --- a/broker/neb/src/broker.cc +++ b/broker/neb/src/broker.cc @@ -214,6 +214,10 @@ void broker_module_init(void const* arg) { e.register_event(neb::pb_host_parent::static_type(), "HostParent", &neb::pb_host_parent::operations, "hosts_hosts_parents"); + + e.register_event(neb::pb_instance_configuration::static_type(), + "InstanceConfiguration", + &neb::pb_instance_configuration::operations, "no_table"); } } } diff --git a/broker/neb/src/initial.cc b/broker/neb/src/initial.cc index 1b63674c185..310d885945b 100644 --- a/broker/neb/src/initial.cc +++ b/broker/neb/src/initial.cc @@ -495,6 +495,18 @@ static void send_pb_service_list() { send_service_list(neb::callback_pb_service); } +/** + * Send the instance configuration loaded event. + */ +static void send_pb_instance_configuration() { + log_v2::neb()->info( + "init: sending initial instance configuration loading event"); + auto ic = std::make_shared(); + ic->mut_obj().set_loaded(true); + ic->mut_obj().set_poller_id(config::applier::state::instance().poller_id()); + neb::gl_publisher.write(ic); +} + /** * Send initial configuration to the global publisher. */ @@ -535,4 +547,5 @@ void neb::send_initial_pb_configuration() { send_pb_service_group_list(); send_pb_host_dependencies_list(); send_pb_service_dependencies_list(); + send_pb_instance_configuration(); } diff --git a/broker/unified_sql/src/stream.cc b/broker/unified_sql/src/stream.cc index 3a48758327a..8d579fbcb39 100644 --- a/broker/unified_sql/src/stream.cc +++ b/broker/unified_sql/src/stream.cc @@ -114,7 +114,9 @@ constexpr void (stream::*const stream::neb_processing_table[])( &stream::_process_pb_host_group_member, &stream::_process_pb_service_group, &stream::_process_pb_service_group_member, - &stream::_process_pb_host_parent}; + &stream::_process_pb_host_parent, + nullptr // pb_instance_configuration +}; constexpr size_t neb_processing_table_size = sizeof(stream::neb_processing_table) / diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 64cd147ee96..391d1c5a9e6 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -37,7 +37,8 @@ add_custom_command( COMMENT "Generating interface files of the proto file (protobuf)" OUTPUT ${SRC_DIR}/process_stat.pb.cc ${SRC_DIR}/process_stat.pb.h COMMAND ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out="${SRC_DIR}" - --proto_path=${SRC_DIR} ${SRC_DIR}/process_stat.proto) + --proto_path=${SRC_DIR} ${SRC_DIR}/process_stat.proto + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) # Set sources. set(SOURCES ${SRC_DIR}/process_stat.cc ${SRC_DIR}/process_stat.pb.cc diff --git a/engine/enginerpc/CMakeLists.txt b/engine/enginerpc/CMakeLists.txt index ff58c45e1e4..80534a5d33e 100644 --- a/engine/enginerpc/CMakeLists.txt +++ b/engine/enginerpc/CMakeLists.txt @@ -46,7 +46,8 @@ add_custom_command( COMMAND ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out="${ENGINERPC_DIR}" --proto_path=${ENGINERPC_DIR} --proto_path=${CMAKE_SOURCE_DIR}/common/src - ${ENGINERPC_DIR}/engine.proto) + ${ENGINERPC_DIR}/engine.proto + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_custom_target( engine_rpc diff --git a/tests/resources/specific-duplication.py b/tests/resources/specific-duplication.py index bcc26752d84..ae05af6ae0c 100644 --- a/tests/resources/specific-duplication.py +++ b/tests/resources/specific-duplication.py @@ -150,6 +150,7 @@ def create_md5_list(content): 0x10027, # pb_host_check 0x10028, # pb_service_check 0x1002e, # pb_responsive_instance + 0x10036 # pb_instance_configuration ]: if md5 in lst: lst[md5] += 1 @@ -219,6 +220,7 @@ def create_md5_list(content): 0x10025, # pb_custom_variable 0x10027, # pb_host_check 0x10028, # pb_service_check + 0x10036 # pb_instance_configuration ]: if md5 in lst: lst[md5] += 1