-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* centreon-agent => centreon-monitoring-agent
* telegraf conf accepts only one host add scheduler, check and check_exec class to agent * otel tests checks resources table * engine accept connections from centreon monitoring agent add reverse client in opentelemetry module * no overlays, provide our own launcher move utf8 to common and some fixes (#1502) add windows-agent.yaml (#1525) * add windows-agent.yaml * fix muxer issue
- Loading branch information
1 parent
b4b14a7
commit bdc89af
Showing
93 changed files
with
6,268 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Centreon Monitoring Agent Windows packaging | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- uses: ilammy/[email protected] | ||
|
||
- name: install vcpkg | ||
run: | | ||
git clone --depth 1 https://github.com/microsoft/vcpkg $HOME/vcpkg | ||
cd $HOME/vcpkg | ||
bootstrap-vcpkg.bat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/** | ||
* 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] | ||
*/ | ||
|
||
#ifndef CENTREON_AGENT_BIREACTOR_HH | ||
#define CENTREON_AGENT_BIREACTOR_HH | ||
|
||
#include "agent.grpc.pb.h" | ||
|
||
namespace com::centreon::agent { | ||
|
||
template <class bireactor_class> | ||
class bireactor | ||
: public bireactor_class, | ||
public std::enable_shared_from_this<bireactor<bireactor_class>> { | ||
private: | ||
static std::set<std::shared_ptr<bireactor>> _instances; | ||
static std::mutex _instances_m; | ||
|
||
bool _write_pending; | ||
std::deque<std::shared_ptr<MessageFromAgent>> _write_queue; | ||
std::shared_ptr<MessageToAgent> _read_current; | ||
|
||
const std::string_view _class_name; | ||
|
||
const std::string _peer; | ||
|
||
protected: | ||
std::shared_ptr<boost::asio::io_context> _io_context; | ||
std::shared_ptr<spdlog::logger> _logger; | ||
|
||
bool _alive; | ||
/** | ||
* @brief All attributes of this object are protected by this mutex | ||
* | ||
*/ | ||
mutable std::mutex _protect; | ||
|
||
public: | ||
bireactor(const std::shared_ptr<boost::asio::io_context>& io_context, | ||
const std::shared_ptr<spdlog::logger>& logger, | ||
const std::string_view& class_name, | ||
const std::string& peer); | ||
|
||
virtual ~bireactor(); | ||
|
||
static void register_stream(const std::shared_ptr<bireactor>& strm); | ||
|
||
void start_read(); | ||
|
||
void start_write(); | ||
void write(const std::shared_ptr<MessageFromAgent>& request); | ||
|
||
// bireactor part | ||
void OnReadDone(bool ok) override; | ||
|
||
virtual void on_incomming_request( | ||
const std::shared_ptr<MessageToAgent>& request) = 0; | ||
|
||
virtual void on_error() = 0; | ||
|
||
void OnWriteDone(bool ok) override; | ||
|
||
// server version | ||
void OnDone(); | ||
// client version | ||
void OnDone(const ::grpc::Status& /*s*/); | ||
|
||
virtual void shutdown(); | ||
}; | ||
|
||
} // namespace com::centreon::agent | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
/** | ||
* Copyright 2024 Centreon | ||
* Licensed under the Apache License, Version 2.0(the "License"); | ||
|
@@ -15,6 +14,7 @@ | |
* | ||
* For more information : [email protected] | ||
*/ | ||
|
||
#ifndef CENTREON_AGENT_CONFIG_HH | ||
#define CENTREON_AGENT_CONFIG_HH | ||
|
||
|
@@ -24,7 +24,7 @@ namespace com::centreon::agent { | |
|
||
class config { | ||
public: | ||
enum log_type { to_stdout, to_file }; | ||
enum log_type { to_stdout, to_file, to_event_log }; | ||
|
||
static const std::string_view config_schema; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* 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] | ||
*/ | ||
|
||
#ifndef CENTREON_AGENT_STREAMING_CLIENT_HH | ||
#define CENTREON_AGENT_STREAMING_CLIENT_HH | ||
|
||
#include "com/centreon/common/grpc/grpc_client.hh" | ||
|
||
#include "bireactor.hh" | ||
#include "scheduler.hh" | ||
|
||
namespace com::centreon::agent { | ||
|
||
class streaming_client; | ||
|
||
class client_reactor | ||
: public bireactor< | ||
::grpc::ClientBidiReactor<MessageFromAgent, MessageToAgent>> { | ||
std::weak_ptr<streaming_client> _parent; | ||
::grpc::ClientContext _context; | ||
|
||
public: | ||
client_reactor(const std::shared_ptr<boost::asio::io_context>& io_context, | ||
const std::shared_ptr<spdlog::logger>& logger, | ||
const std::shared_ptr<streaming_client>& parent, | ||
const std::string& peer); | ||
|
||
std::shared_ptr<client_reactor> shared_from_this() { | ||
return std::static_pointer_cast<client_reactor>( | ||
bireactor<::grpc::ClientBidiReactor<MessageFromAgent, MessageToAgent>>:: | ||
shared_from_this()); | ||
} | ||
|
||
::grpc::ClientContext& get_context() { return _context; } | ||
|
||
void on_incomming_request( | ||
const std::shared_ptr<MessageToAgent>& request) override; | ||
|
||
void on_error() override; | ||
|
||
void shutdown() override; | ||
}; | ||
|
||
/** | ||
* @brief this object not only manages connection to engine, but also embed | ||
* check scheduler | ||
* | ||
*/ | ||
class streaming_client : public common::grpc::grpc_client_base, | ||
public std::enable_shared_from_this<streaming_client> { | ||
std::shared_ptr<boost::asio::io_context> _io_context; | ||
std::shared_ptr<spdlog::logger> _logger; | ||
std::string _supervised_host; | ||
|
||
std::unique_ptr<AgentService::Stub> _stub; | ||
|
||
std::shared_ptr<client_reactor> _reactor; | ||
std::shared_ptr<scheduler> _sched; | ||
|
||
/** | ||
* @brief All attributes of this object are protected by this mutex | ||
* | ||
*/ | ||
std::mutex _protect; | ||
|
||
void _create_reactor(); | ||
|
||
void _start(); | ||
|
||
void _send(const std::shared_ptr<MessageFromAgent>& request); | ||
|
||
public: | ||
streaming_client(const std::shared_ptr<boost::asio::io_context>& io_context, | ||
const std::shared_ptr<spdlog::logger>& logger, | ||
const std::shared_ptr<common::grpc::grpc_config>& conf, | ||
const std::string& supervised_host); | ||
|
||
static std::shared_ptr<streaming_client> load( | ||
const std::shared_ptr<boost::asio::io_context>& io_context, | ||
const std::shared_ptr<spdlog::logger>& logger, | ||
const std::shared_ptr<common::grpc::grpc_config>& conf, | ||
const std::string& supervised_host); | ||
|
||
void on_incomming_request(const std::shared_ptr<client_reactor>& caller, | ||
const std::shared_ptr<MessageToAgent>& request); | ||
void on_error(const std::shared_ptr<client_reactor>& caller); | ||
|
||
void shutdown(); | ||
|
||
// use only for tests | ||
engine_to_agent_request_ptr get_last_message_to_agent() const { | ||
return _sched->get_last_message_to_agent(); | ||
} | ||
}; | ||
|
||
} // namespace com::centreon::agent | ||
|
||
#endif |
Oops, something went wrong.