Class Monitor

Inheritance Relationships

Derived Types

Class Documentation

class Monitor

Generic class to write JSON strings containing monitoring information in UNIX FIFOs.

Subclassed by FromHostMonitor, ToHostMonitor

Public Functions

inline explicit Monitor(std::unique_ptr<Writer> writer)

Constructor to initialize the Monitor with a Writer.

Parameters:

writer -- Unique pointer to a Writer object.

virtual ~Monitor() = default

Virtual destructor.

Monitor(Monitor&&) noexcept = default
Monitor &operator=(Monitor&&) noexcept = default
Monitor(const Monitor&) = delete
Monitor &operator=(const Monitor&) = delete
inline std::string get_serialized_message()

Get the serialized JSON message as a string.

Returns:

Serialized JSON message.

inline void write_message()

Write the JSON message using a Writer.

inline void create_new_message(const std::string &hostname)

Create a new JSON message, initializing it with the given timestamp and hostname.

Parameters:

hostname -- The hostname for the new message.

Protected Attributes

nlohmann::json m_message = {}

JSON object to store the monitoring message.

std::unique_ptr<Writer> m_writer

Unique pointer to a monitoring Writer object.