diff --git a/engine/modules/opentelemetry/doc/opentelemetry.md b/engine/modules/opentelemetry/doc/opentelemetry.md index 73568749bb..f83f8bb24c 100644 --- a/engine/modules/opentelemetry/doc/opentelemetry.md +++ b/engine/modules/opentelemetry/doc/opentelemetry.md @@ -190,8 +190,8 @@ An example of configuration: "http_server" : { "port": 1443, "encryption": true, - "certificate_path": "server.crt", - "key_path": "server.key" + "public_cert": "server.crt", + "private_key": "server.key" }, "engine_otel_endpoint": "172.17.0.1:4317", "check_interval":60 diff --git a/engine/modules/opentelemetry/doc/otel_configuration.odg b/engine/modules/opentelemetry/doc/otel_configuration.odg index eaf01c1bf0..14831418da 100644 Binary files a/engine/modules/opentelemetry/doc/otel_configuration.odg and b/engine/modules/opentelemetry/doc/otel_configuration.odg differ diff --git a/engine/modules/opentelemetry/doc/otel_configuration.pdf b/engine/modules/opentelemetry/doc/otel_configuration.pdf index b4107e644a..10105d81fc 100644 Binary files a/engine/modules/opentelemetry/doc/otel_configuration.pdf and b/engine/modules/opentelemetry/doc/otel_configuration.pdf differ diff --git a/engine/modules/opentelemetry/inc/com/centreon/engine/modules/opentelemetry/telegraf/conf_server.hh b/engine/modules/opentelemetry/inc/com/centreon/engine/modules/opentelemetry/telegraf/conf_server.hh index de38e9cc70..030dfe4939 100644 --- a/engine/modules/opentelemetry/inc/com/centreon/engine/modules/opentelemetry/telegraf/conf_server.hh +++ b/engine/modules/opentelemetry/inc/com/centreon/engine/modules/opentelemetry/telegraf/conf_server.hh @@ -31,8 +31,8 @@ class conf_server_config { asio::ip::tcp::endpoint _listen_endpoint; bool _crypted; unsigned _second_keep_alive_interval; - std::string _certificate_path; - std::string _key_path; + std::string _public_cert; + std::string _private_key; unsigned _check_interval; public: @@ -51,8 +51,8 @@ class conf_server_config { unsigned get_check_interval() const { return _check_interval; } - const std::string& get_certificate_path() const { return _certificate_path; } - const std::string& get_key_path() const { return _key_path; } + const std::string& get_public_cert() const { return _public_cert; } + const std::string& get_private_key() const { return _private_key; } bool operator==(const conf_server_config& right) const; }; diff --git a/engine/modules/opentelemetry/src/open_telemetry.cc b/engine/modules/opentelemetry/src/open_telemetry.cc index 776cecfba1..1e8e6cdcde 100644 --- a/engine/modules/opentelemetry/src/open_telemetry.cc +++ b/engine/modules/opentelemetry/src/open_telemetry.cc @@ -182,7 +182,7 @@ void open_telemetry::_create_telegraf_conf_server( std::chrono::seconds(10), std::chrono::seconds(30), std::chrono::seconds(300), 30, std::chrono::seconds(10), 0, std::chrono::hours(1), 1, asio::ssl::context::tlsv12, - telegraf_conf->get_certificate_path(), telegraf_conf->get_key_path()); + telegraf_conf->get_public_cert(), telegraf_conf->get_private_key()); if (telegraf_conf->is_crypted()) { _telegraf_conf_server = http::server::load( diff --git a/engine/modules/opentelemetry/src/telegraf/conf_server.cc b/engine/modules/opentelemetry/src/telegraf/conf_server.cc index 65d3f62522..26c8208c45 100644 --- a/engine/modules/opentelemetry/src/telegraf/conf_server.cc +++ b/engine/modules/opentelemetry/src/telegraf/conf_server.cc @@ -62,12 +62,12 @@ static constexpr std::string_view _config_schema(R"( "minimum": 0, "maximum": 3600 }, - "certificate_path": { + "public_cert": { "description": "path of the certificate file of the server", "type": "string", "minLength": 5 }, - "key_path": { + "private_key": { "description": "path of the key file", "type": "string", "minLength": 5 @@ -122,10 +122,10 @@ conf_server_config::conf_server_config(const rapidjson::Value& json_config_v, _second_keep_alive_interval = http_json_config.get_unsigned("keepalive_interval", 30); - _certificate_path = http_json_config.get_string("certificate_path", ""); - _key_path = http_json_config.get_string("key_path", ""); + _public_cert = http_json_config.get_string("public_cert", ""); + _private_key = http_json_config.get_string("private_key", ""); if (_crypted) { - if (_certificate_path.empty()) { + if (_public_cert.empty()) { SPDLOG_LOGGER_ERROR(config_logger, "telegraf conf server encryption activated and no " "certificate path " @@ -135,7 +135,7 @@ conf_server_config::conf_server_config(const rapidjson::Value& json_config_v, "path " "provided"); } - if (_key_path.empty()) { + if (_private_key.empty()) { SPDLOG_LOGGER_ERROR(config_logger, "telegraf conf server encryption activated and no " "certificate key path provided"); @@ -144,23 +144,23 @@ conf_server_config::conf_server_config(const rapidjson::Value& json_config_v, "telegraf conf server encryption activated and no certificate key " "path provided"); } - if (::access(_certificate_path.c_str(), R_OK)) { + if (::access(_public_cert.c_str(), R_OK)) { SPDLOG_LOGGER_ERROR( config_logger, "telegraf conf server unable to read certificate file {}", - _certificate_path); + _public_cert); throw exceptions::msg_fmt( "telegraf conf server unable to read certificate file {}", - _certificate_path); + _public_cert); } - if (::access(_key_path.c_str(), R_OK)) { + if (::access(_private_key.c_str(), R_OK)) { SPDLOG_LOGGER_ERROR( config_logger, "telegraf conf server unable to read certificate key file {}", - _key_path); + _private_key); throw exceptions::msg_fmt( "telegraf conf server unable to read certificate key file {}", - _key_path); + _private_key); } } } else { @@ -175,8 +175,8 @@ bool conf_server_config::operator==(const conf_server_config& right) const { return _listen_endpoint == right._listen_endpoint && _crypted == right._crypted && _second_keep_alive_interval == right._second_keep_alive_interval && - _certificate_path == right._certificate_path && - _key_path == right._key_path && + _public_cert == right._public_cert && + _private_key == right._private_key && _check_interval == right._check_interval; } diff --git a/tests/broker-engine/opentelemetry.robot b/tests/broker-engine/opentelemetry.robot index 5c435e6d9a..1a4910ec1b 100644 --- a/tests/broker-engine/opentelemetry.robot +++ b/tests/broker-engine/opentelemetry.robot @@ -222,7 +222,7 @@ BEOTEL_SERVE_TELEGRAF_CONFIGURATION_CRYPTED Ctn Config Engine ${1} ${3} ${2} Ctn Add Otl ServerModule ... 0 - ... {"otel_server":{"host": "0.0.0.0","port": 4317},"max_length_grpc_log":0, "telegraf_conf_server": {"http_server":{"port": 1443, "encryption": true, "certificate_path": "/tmp/otel/server.crt", "key_path": "/tmp/otel/server.key"}, "check_interval":60, "engine_otel_endpoint": "127.0.0.1:4317"}} + ... {"otel_server":{"host": "0.0.0.0","port": 4317},"max_length_grpc_log":0, "telegraf_conf_server": {"http_server":{"port": 1443, "encryption": true, "public_cert": "/tmp/otel/server.crt", "private_key": "/tmp/otel/server.key"}, "check_interval":60, "engine_otel_endpoint": "127.0.0.1:4317"}} Ctn Config Add Otl Connector ... 0 ... OTEL connector diff --git a/tests/resources/resources.resource b/tests/resources/resources.resource index c2930b7a3c..d1143f9da9 100644 --- a/tests/resources/resources.resource +++ b/tests/resources/resources.resource @@ -73,9 +73,9 @@ Ctn Clear Broker Logs Ctn Start Broker [Arguments] ${only_central}=False - Start Process /usr/sbin/cbd ${EtcRoot}/centreon-broker/central-broker.json alias=b1 + Start Process /usr/sbin/cbd ${EtcRoot}/centreon-broker/central-broker.json alias=b1 stdout=${BROKER_LOG}/central-broker-master-stdout.log stderr=${BROKER_LOG}/central-broker-master-stderr.log IF not ${only_central} - Start Process /usr/sbin/cbd ${EtcRoot}/centreon-broker/central-rrd.json alias=b2 + Start Process /usr/sbin/cbd ${EtcRoot}/centreon-broker/central-rrd.json alias=b2 stdout=${BROKER_LOG}/central-rrd-stdout.log stderr=${BROKER_LOG}/central-rrd-stderr.log END Ctn Restart Broker @@ -156,7 +156,7 @@ Ctn Start Engine EXCEPT Log can't remove ${lib}/rw/centengine.cmd don't worry END - Start Process /usr/sbin/centengine ${conf} alias=${alias} + Start Process /usr/sbin/centengine ${conf} alias=${alias} stdout=${log}/centengine-stdout.log stderr=${log}/centengine-stderr.log END Ctn Start Engine With Extend Conf @@ -285,10 +285,8 @@ Ctn Save Logs Create Directory failed ${failDir} Catenate SEPARATOR= failed/ ${Test Name} Create Directory ${failDir} - Copy Files ${centralLog} ${failDir} - Copy Files ${rrdLog} ${failDir} - Copy Files ${moduleLog0} ${failDir} - Copy Files ${engineLog0} ${failDir} + Copy Files ${BROKER_LOG}/* ${failDir} + Copy Files ${ENGINE_LOG}/config0/*.log ${failDir} Copy Files ${ENGINE_LOG}/*.log ${failDir} Copy Files ${EtcRoot}/centreon-engine/config0/*.cfg ${failDir}/etc/centreon-engine/config0 Copy Files ${EtcRoot}/centreon-engine/*.json ${failDir}/etc/centreon-engine