Skip to content

Commit

Permalink
fix(broker/bam): ba initialization
Browse files Browse the repository at this point in the history
REFS: MON-35581
  • Loading branch information
bouda1 authored Feb 27, 2024
1 parent 255726e commit f172341
Show file tree
Hide file tree
Showing 72 changed files with 1,111 additions and 702 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ broker/libroker.a
broker/librokerbase.a
broker/test/python/*.crt
broker/test/python/*.key
broker/compile_commands.json
broker/grpc/grpc_stream.proto
broker/grpc/src/grpc_bridge.cc

# clib
clib/inc/com/centreon/clib/version.hh
Expand Down
23 changes: 12 additions & 11 deletions bbdo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
#

set(protobuf_files
header
rebuild_message
remove_graph_message
severity
tag
bbdo
neb
storage
bam)
header
rebuild_message
remove_graph_message
severity
tag
bbdo
neb
storage
bam
bam_state)

foreach(name IN LISTS protobuf_files)
set(proto_file "${name}.proto")
Expand Down Expand Up @@ -69,8 +70,8 @@ add_library(pb_tag_lib STATIC tag.pb.cc tag.pb.h)
add_dependencies(pb_tag_lib target_neb)
set_target_properties(pb_tag_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)

add_library(pb_bam_lib STATIC bam.pb.cc bam.pb.h)
add_dependencies(pb_bam_lib target_bam target_header)
add_library(pb_bam_lib STATIC bam.pb.cc bam.pb.h bam_state.pb.cc bam_state.pb.h)
add_dependencies(pb_bam_lib target_bam target_bam_state target_header)
set_target_properties(pb_bam_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)

macro(get_protobuf_files name)
Expand Down
204 changes: 102 additions & 102 deletions bbdo/bam.proto
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
** Copyright 2022 Centreon
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
** For more information : [email protected]
*/
/**
* Copyright 2022-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*/

syntax = "proto3";

Expand All @@ -23,16 +23,16 @@ import "header.proto";
package com.centreon.broker;

enum State {
OK = 0;
WARNING = 1;
CRITICAL = 2;
UNKNOWN = 3;
OK = 0;
WARNING = 1;
CRITICAL = 2;
UNKNOWN = 3;
}

message InheritedDowntime {
BBDOHeader header = 1;
uint32 ba_id = 2;
bool in_downtime = 3;
BBDOHeader header = 1;
uint32 ba_id = 2;
bool in_downtime = 3;
}

message BaStatus {
Expand All @@ -47,111 +47,111 @@ message BaStatus {
}

message BaEvent {
uint32 ba_id = 1;
double first_level = 2;
int64 end_time = 3;
bool in_downtime = 4;
uint64 start_time = 5;
State status = 6;
uint32 ba_id = 1;
double first_level = 2;
int64 end_time = 3;
bool in_downtime = 4;
uint64 start_time = 5;
State status = 6;
}

message KpiEvent {
uint32 ba_id = 1;
uint64 start_time = 2;
int64 end_time = 3;
uint32 kpi_id = 4;
int32 impact_level = 5;
bool in_downtime = 6;
string output = 7;
string perfdata = 8;
State status = 9;
uint32 ba_id = 1;
uint64 start_time = 2;
int64 end_time = 3;
uint32 kpi_id = 4;
int32 impact_level = 5;
bool in_downtime = 6;
string output = 7;
string perfdata = 8;
State status = 9;
}

message DimensionBvEvent {
uint32 bv_id = 1;
string bv_name = 2;
string bv_description = 3;
uint32 bv_id = 1;
string bv_name = 2;
string bv_description = 3;
}

message DimensionBaBvRelationEvent {
uint32 ba_id = 1;
uint32 bv_id = 2;
uint32 ba_id = 1;
uint32 bv_id = 2;
}

message DimensionTimeperiod {
uint32 id = 1;
string name = 2;
string monday = 3;
string tuesday = 4;
string wednesday = 5;
string thursday = 6;
string friday = 7;
string saturday = 8;
string sunday = 9;
uint32 id = 1;
string name = 2;
string monday = 3;
string tuesday = 4;
string wednesday = 5;
string thursday = 6;
string friday = 7;
string saturday = 8;
string sunday = 9;
}

message DimensionBaEvent {
uint32 ba_id = 1;
string ba_name = 2;
string ba_description = 3;
double sla_month_percent_crit = 4;
double sla_month_percent_warn = 5;
uint32 sla_duration_crit = 6;
uint32 sla_duration_warn = 7;
uint32 ba_id = 1;
string ba_name = 2;
string ba_description = 3;
double sla_month_percent_crit = 4;
double sla_month_percent_warn = 5;
uint32 sla_duration_crit = 6;
uint32 sla_duration_warn = 7;
}

message DimensionKpiEvent {
uint32 kpi_id = 1;
uint32 ba_id = 2;
string ba_name = 3;
uint32 host_id = 4;
string host_name = 5;
uint32 service_id = 6;
string service_description = 7;
uint32 kpi_ba_id = 8;
string kpi_ba_name = 9;
uint32 meta_service_id = 10;
string meta_service_name = 11;
uint32 boolean_id = 12;
string boolean_name = 13;
double impact_warning = 14;
double impact_critical = 15;
double impact_unknown = 16;
uint32 kpi_id = 1;
uint32 ba_id = 2;
string ba_name = 3;
uint32 host_id = 4;
string host_name = 5;
uint32 service_id = 6;
string service_description = 7;
uint32 kpi_ba_id = 8;
string kpi_ba_name = 9;
uint32 meta_service_id = 10;
string meta_service_name = 11;
uint32 boolean_id = 12;
string boolean_name = 13;
double impact_warning = 14;
double impact_critical = 15;
double impact_unknown = 16;
}

message KpiStatus {
uint32 kpi_id = 1;
bool in_downtime = 2;
double level_acknowledgement_hard = 3;
double level_acknowledgement_soft = 4;
double level_downtime_hard = 5;
double level_downtime_soft = 6;
double level_nominal_hard = 7;
double level_nominal_soft = 8;
State state_hard = 9;
State state_soft = 10;
int64 last_state_change = 11;
double last_impact = 12;
bool valid = 13;
uint32 kpi_id = 1;
bool in_downtime = 2;
double level_acknowledgement_hard = 3;
double level_acknowledgement_soft = 4;
double level_downtime_hard = 5;
double level_downtime_soft = 6;
double level_nominal_hard = 7;
double level_nominal_soft = 8;
State state_hard = 9;
State state_soft = 10;
int64 last_state_change = 11;
double last_impact = 12;
bool valid = 13;
}

message BaDurationEvent {
uint32 ba_id = 1;
int64 real_start_time = 2;
int64 end_time = 3;
int64 start_time = 4;
uint32 duration = 5;
uint32 sla_duration = 6;
uint32 timeperiod_id = 7;
bool timeperiod_is_default = 8;
uint32 ba_id = 1;
int64 real_start_time = 2;
int64 end_time = 3;
int64 start_time = 4;
uint32 duration = 5;
uint32 sla_duration = 6;
uint32 timeperiod_id = 7;
bool timeperiod_is_default = 8;
}

message DimensionBaTimeperiodRelation {
uint32 ba_id = 1;
uint32 timeperiod_id = 2;
bool is_default = 3;
uint32 ba_id = 1;
uint32 timeperiod_id = 2;
bool is_default = 3;
}

message DimensionTruncateTableSignal {
bool update_started = 1;
}
bool update_started = 1;
}
46 changes: 46 additions & 0 deletions bbdo/bam_state.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright 2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*/

syntax = "proto3";

import "bam.proto";

package com.centreon.broker;

/**
* @brief Stores needed information for bool_service or kpi_service. Very useful
* when broker is stopped to save the BA's states.
*/
message ServiceState {
uint64 host_id = 1;
uint64 service_id = 2;
State current_state = 3;
State last_hard_state = 4;
uint64 last_check = 5;
bool state_type = 6;
bool acknowledged = 7;
}

/**
* @brief This message contains the living informations of the current BA's.
* Thanks to them we can recompute their states when Broker is restarted.
*/
/*io::bam, bam::de_pb_services_book_state*/
message ServicesBookState {
repeated ServiceState service = 1;
}
3 changes: 2 additions & 1 deletion bbdo/events.hh
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ enum data_element {
de_pb_kpi_status = 27,
de_pb_ba_duration_event = 28,
de_pb_dimension_ba_timeperiod_relation = 29,
de_pb_dimension_truncate_table_signal = 30
de_pb_dimension_truncate_table_signal = 30,
de_pb_services_book_state = 31,
};
}

Expand Down
34 changes: 17 additions & 17 deletions broker/bam/inc/com/centreon/broker/bam/availability_thread.hh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
** Copyright 2014 - 2021 Centreon
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
** For more information : [email protected]
*/
/**
* Copyright 2014 - 2021-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*/

#ifndef CCB_BAM_AVAILABILITY_THREAD_HH
#define CCB_BAM_AVAILABILITY_THREAD_HH
Expand Down
Loading

0 comments on commit f172341

Please sign in to comment.