Add creation and destruction of monitors
Monitors can now be created and destroyed at runtime. The configurations for new monitors are persisted to disk.
This commit is contained in:
@ -157,3 +157,23 @@ bool runtime_create_listener(SERVICE *service, const char *name, const char *add
|
||||
* @return True if the listener was successfully destroyed
|
||||
*/
|
||||
bool runtime_destroy_listener(SERVICE *service, const char *name);
|
||||
|
||||
/**
|
||||
* @brief Create a new monitor
|
||||
*
|
||||
* @param name Name of the monitor
|
||||
* @param module Monitor module
|
||||
* @return True if new monitor was created and persisted
|
||||
*/
|
||||
bool runtime_create_monitor(const char *name, const char *module);
|
||||
|
||||
/**
|
||||
* @brief Destroy a monitor
|
||||
*
|
||||
* Monitors are not removed from the runtime configuration but they are stopped.
|
||||
* Destroyed monitor are removed after a restart.
|
||||
*
|
||||
* @param monitor Monitor to destroy
|
||||
* @return True if monitor was destroyed
|
||||
*/
|
||||
bool runtime_destroy_monitor(MONITOR *monitor);
|
||||
|
@ -196,6 +196,7 @@ struct monitor
|
||||
* two times the option value.
|
||||
*/
|
||||
MONITOR_OBJECT *module; /**< The "monitor object" */
|
||||
char *module_name; /**< Name of the monitor module */
|
||||
void *handle; /**< Handle returned from startMonitor */
|
||||
size_t interval; /**< The monitor interval */
|
||||
struct monitor *next; /**< Next monitor in the linked list */
|
||||
@ -243,7 +244,7 @@ void mon_log_state_change(MONITOR_SERVERS *ptr);
|
||||
void mon_hangup_failed_servers(MONITOR *monitor);
|
||||
|
||||
/**
|
||||
* @brief Serialize a monitor to a file
|
||||
* @brief Serialize the servers of a monitor to a file
|
||||
*
|
||||
* This partially converts @c monitor into an INI format file. Only the servers
|
||||
* of the monitor are serialized. This allows the monitor to keep monitoring
|
||||
@ -258,6 +259,16 @@ void mon_hangup_failed_servers(MONITOR *monitor);
|
||||
*/
|
||||
bool monitor_serialize_servers(const MONITOR *monitor);
|
||||
|
||||
/**
|
||||
* @brief Serialize a monitor to a file
|
||||
*
|
||||
* This converts the static configuration of the monitor into an INI format file.
|
||||
*
|
||||
* @param monitor Monitor to serialize
|
||||
* @return True if serialization was successful
|
||||
*/
|
||||
bool monitor_serialize(const MONITOR *monitor);
|
||||
|
||||
/**
|
||||
* Check if a monitor uses @c servers
|
||||
* @param server Server that is queried
|
||||
|
Reference in New Issue
Block a user