aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-20 08:18:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-20 08:18:10 +0100
commitb2e00622655fc48d0f3d2db9bc784441c994602b (patch)
tree8550c34a42cb904a2a9258086dac54cfe6cd587c /src/libserver
parent5d37e69a60b836818823a6c43cb4269d10d82094 (diff)
downloadrspamd-b2e00622655fc48d0f3d2db9bc784441c994602b.tar.gz
rspamd-b2e00622655fc48d0f3d2db9bc784441c994602b.zip
[Feature] Allow to configure monitored
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_file.h5
-rw-r--r--src/libserver/cfg_rcl.c12
-rw-r--r--src/libserver/monitored.c4
3 files changed, 20 insertions, 1 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 44b8dd85a..45202f5ab 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -377,7 +377,10 @@ struct rspamd_config {
GList *maps; /**< maps active */
gdouble map_timeout; /**< maps watch timeout */
- gdouble map_file_watch_multiplier; /**< multiplier for watch timeout when maps are files */
+ gdouble map_file_watch_multiplier; /**< multiplier for watch timeout when maps are files */
+
+ gdouble monitored_interval; /**< interval between monitored checks */
+ gboolean disable_monitored; /**< disable monitoring completely */
struct symbols_cache *cache; /**< symbols cache object */
gchar *cache_filename; /**< filename of cache file */
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 67f91ab9b..596be1cf6 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1990,6 +1990,18 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
0,
"Multiplier for map watch interval when map is file");
rspamd_rcl_add_default_handler (sub,
+ "monitoring_watch_interval",
+ rspamd_rcl_parse_struct_time,
+ G_STRUCT_OFFSET (struct rspamd_config, monitored_interval),
+ RSPAMD_CL_FLAG_TIME_FLOAT,
+ "Interval for checking monitored instances");
+ rspamd_rcl_add_default_handler (sub,
+ "disable_monitoring",
+ rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct rspamd_config, disable_monitored),
+ 0,
+ "Disable monitoring completely");
+ rspamd_rcl_add_default_handler (sub,
"dynamic_conf",
rspamd_rcl_parse_struct_string,
G_STRUCT_OFFSET (struct rspamd_config, dynamic_conf),
diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c
index 01979b11e..cc11183b2 100644
--- a/src/libserver/monitored.c
+++ b/src/libserver/monitored.c
@@ -414,6 +414,10 @@ rspamd_monitored_ctx_config (struct rspamd_monitored_ctx *ctx,
ctx->change_cb = change_cb;
ctx->ud = ud;
+ if (cfg->monitored_interval != 0) {
+ ctx->monitoring_interval = cfg->monitored_interval;
+ }
+
/* Start all events */
for (i = 0; i < ctx->elts->len; i ++) {
m = g_ptr_array_index (ctx->elts, i);