MXS-1775 Add disk space threshold to server and monitor

- Instance variable.
- Functions for setting it from configuration file.
This commit is contained in:
Johan Wikman
2018-05-23 11:24:54 +03:00
parent cb8cd4be3d
commit 11c04ff8a8
4 changed files with 83 additions and 0 deletions

View File

@ -266,6 +266,7 @@ struct mxs_monitor
time_t journal_max_age; /**< Maximum age of journal file */
uint32_t script_timeout; /**< Timeout in seconds for the monitor scripts */
uint8_t journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */
MxsDiskSpaceThreshold* disk_space_threshold; /**< Disk space thresholds */
struct mxs_monitor *next; /**< Next monitor in the linked list */
};
@ -444,4 +445,14 @@ MXS_MONITORED_SERVER* mon_get_monitored_server(const MXS_MONITOR* mon, SERVER* s
int mon_config_get_servers(const MXS_CONFIG_PARAMETER* params, const char* key, const MXS_MONITOR* mon,
MXS_MONITORED_SERVER*** monitored_array_out);
/**
* @brief Set the disk space threshold of a monitor
*
* @param server The monitor.
* @param disk_space_threshold The disk space threshold as specified in the config file.
*
* @return True, if the provided string is valid and the threshold could be set.
*/
bool monitor_set_disk_space_threshold(MXS_MONITOR *monitor, const char *disk_space_threshold);
MXS_END_DECLS

View File

@ -19,6 +19,7 @@
*/
#include <maxscale/cdefs.h>
#include <maxscale/config.h>
#include <maxscale/dcb.h>
#include <maxscale/resultset.h>
#include <maxscale/jansson.h>
@ -159,6 +160,7 @@ typedef struct server
bool master_err_is_logged; /**< If node failed, this indicates whether it is logged. Only used
* by rwsplit. TODO: Move to rwsplit */
bool warn_ssl_not_enabled; /**< SSL not used for an SSL enabled server */
MxsDiskSpaceThreshold* disk_space_threshold; /**< Disk space thresholds */
#if defined(SS_DEBUG)
skygw_chk_t server_chk_tail;
#endif
@ -359,6 +361,16 @@ json_t* server_to_json(const SERVER* server, const char* host);
*/
json_t* server_list_to_json(const char* host);
/**
* @brief Set the disk space threshold of the server
*
* @param server The server.
* @param disk_space_threshold The disk space threshold as specified in the config file.
*
* @return True, if the provided string is valid and the threshold could be set.
*/
bool server_set_disk_space_threshold(SERVER *server, const char *disk_space_threshold);
extern int server_free(SERVER *server);
extern SERVER *server_find_by_unique_name(const char *name);
extern int server_find_by_unique_names(char **server_names, int size, SERVER*** output);