Leosac  0.8.0
Open Source Access Control
Leosac::Module::Monitor::MonitorModule Class Reference

Main class for the monitor module. More...

#include <MonitorModule.hpp>

+ Inheritance diagram for Leosac::Module::Monitor::MonitorModule:
+ Collaboration diagram for Leosac::Module::Monitor::MonitorModule:

Public Member Functions

 MonitorModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 
 MonitorModule (const MonitorModule &)=delete
 
 MonitorModule (MonitorModule &&)=delete
 
MonitorModuleoperator= (const MonitorModule &)=delete
 
MonitorModuleoperator= (MonitorModule &&)=delete
 
virtual void run () override
 This is the main loop of the module. More...
 
- Public Member Functions inherited from Leosac::Module::BaseModule
 BaseModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 Constructor of BaseModule. More...
 
virtual ~BaseModule ()=default
 

Private Types

using TimePoint = std::chrono::system_clock::time_point
 

Private Member Functions

void process_config ()
 
void process_network_config ()
 Load config related to network monitoring. More...
 
void process_reader_config ()
 Load config related to reader activity monitoring. More...
 
std::string req_scripts_dir ()
 Get scripts directory from kernel. More...
 
void log_system_bus ()
 Called when a message arrives on the system bus and we are configured to log that. More...
 
void test_ping ()
 

Private Attributes

zmqpp::socket bus_
 
bool verbose_
 
std::string addr_to_ping_
 
std::string reader_to_watch_
 
std::unique_ptr< Leosac::Hardware::FLEDnetwork_led_
 Led for feedback about network availability. More...
 
std::unique_ptr< Leosac::Hardware::FLEDreader_led_
 Led for feedback about reader activity. More...
 
std::unique_ptr< Leosac::Hardware::FLEDsystem_led_
 Led for feedback about system readiness. More...
 
TimePoint last_ping_
 
zmqpp::socket kernel_
 

Additional Inherited Members

- Protected Member Functions inherited from Leosac::Module::BaseModule
virtual void handle_pipe ()
 The base class register the pipe_ socket to its reactor_ so that this function is called when the pipe_ is available from reading. More...
 
virtual void handle_control ()
 Handle called when a message on the module's control socket arrives. More...
 
virtual void dump_additional_config (zmqpp::message *out) const
 Dump additional configuration (for example module specific config file). More...
 
void dump_config (ConfigManager::ConfigFormat fmt, zmqpp::message *out_msg) const
 Fills a message with the module's configuration information. More...
 
void config_check (const std::string &obj_name, Leosac::Hardware::DeviceClass type)
 An helper that checks configuration the existence of some objects. More...
 
void config_check (const std::string &obj_name)
 An helper that checks configuration the existence of some objects. More...
 
- Protected Attributes inherited from Leosac::Module::BaseModule
zmqpp::context & ctx_
 A reference to the ZeroMQ context in case you need it to create additional socket. More...
 
zmqpp::socket & pipe_
 A reference to the pair socket that link back to the module manager. More...
 
boost::property_tree::ptree config_
 The configuration tree passed to the start_module function. More...
 
CoreUtilsPtr utils_
 Pointer to the core utils, which gives access to scheduler and others. More...
 
bool is_running_
 Boolean indicating whether the main loop should run or not. More...
 
zmqpp::socket control_
 Control REP socket. More...
 
zmqpp::reactor reactor_
 The reactor object we poll() on in the main loop. More...
 
std::string name_
 

Detailed Description

Main class for the monitor module.

Definition at line 39 of file MonitorModule.hpp.

Member Typedef Documentation

◆ TimePoint

using Leosac::Module::Monitor::MonitorModule::TimePoint = std::chrono::system_clock::time_point
private

Definition at line 56 of file MonitorModule.hpp.

Constructor & Destructor Documentation

◆ MonitorModule() [1/3]

MonitorModule::MonitorModule ( zmqpp::context &  ctx,
zmqpp::socket *  pipe,
const boost::property_tree::ptree &  cfg,
CoreUtilsPtr  utils 
)

Definition at line 36 of file MonitorModule.cpp.

◆ MonitorModule() [2/3]

Leosac::Module::Monitor::MonitorModule::MonitorModule ( const MonitorModule )
delete

◆ MonitorModule() [3/3]

Leosac::Module::Monitor::MonitorModule::MonitorModule ( MonitorModule &&  )
delete

Member Function Documentation

◆ log_system_bus()

void MonitorModule::log_system_bus ( )
private

Called when a message arrives on the system bus and we are configured to log that.

Definition at line 68 of file MonitorModule.cpp.

◆ operator=() [1/2]

MonitorModule& Leosac::Module::Monitor::MonitorModule::operator= ( const MonitorModule )
delete

◆ operator=() [2/2]

MonitorModule& Leosac::Module::Monitor::MonitorModule::operator= ( MonitorModule &&  )
delete

◆ process_config()

void MonitorModule::process_config ( )
private

Definition at line 155 of file MonitorModule.cpp.

◆ process_network_config()

void MonitorModule::process_network_config ( )
private

Load config related to network monitoring.

Definition at line 183 of file MonitorModule.cpp.

◆ process_reader_config()

void MonitorModule::process_reader_config ( )
private

Load config related to reader activity monitoring.

Definition at line 195 of file MonitorModule.cpp.

◆ req_scripts_dir()

std::string MonitorModule::req_scripts_dir ( )
private

Get scripts directory from kernel.

Definition at line 140 of file MonitorModule.cpp.

◆ run()

void MonitorModule::run ( )
overridevirtual

This is the main loop of the module.

It should only exit when receiving signal::stop on its pipe_ socket. This is completely handled by this base class. In case you override this, make sure you watch the pipe_ socket.

Reimplemented from Leosac::Module::BaseModule.

Definition at line 52 of file MonitorModule.cpp.

◆ test_ping()

void MonitorModule::test_ping ( )
private

Definition at line 119 of file MonitorModule.cpp.

Member Data Documentation

◆ addr_to_ping_

std::string Leosac::Module::Monitor::MonitorModule::addr_to_ping_
private

Definition at line 87 of file MonitorModule.hpp.

◆ bus_

zmqpp::socket Leosac::Module::Monitor::MonitorModule::bus_
private

Definition at line 83 of file MonitorModule.hpp.

◆ kernel_

zmqpp::socket Leosac::Module::Monitor::MonitorModule::kernel_
private

Definition at line 108 of file MonitorModule.hpp.

◆ last_ping_

TimePoint Leosac::Module::Monitor::MonitorModule::last_ping_
private

Definition at line 106 of file MonitorModule.hpp.

◆ network_led_

std::unique_ptr<Leosac::Hardware::FLED> Leosac::Module::Monitor::MonitorModule::network_led_
private

Led for feedback about network availability.

Definition at line 94 of file MonitorModule.hpp.

◆ reader_led_

std::unique_ptr<Leosac::Hardware::FLED> Leosac::Module::Monitor::MonitorModule::reader_led_
private

Led for feedback about reader activity.

Definition at line 99 of file MonitorModule.hpp.

◆ reader_to_watch_

std::string Leosac::Module::Monitor::MonitorModule::reader_to_watch_
private

Definition at line 89 of file MonitorModule.hpp.

◆ system_led_

std::unique_ptr<Leosac::Hardware::FLED> Leosac::Module::Monitor::MonitorModule::system_led_
private

Led for feedback about system readiness.

Definition at line 104 of file MonitorModule.hpp.

◆ verbose_

bool Leosac::Module::Monitor::MonitorModule::verbose_
private

Definition at line 85 of file MonitorModule.hpp.


The documentation for this class was generated from the following files: