diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-01 22:33:59 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-01 22:33:59 +0000 |
commit | 526afdf95a5ab8a12a96c3095501265077ff24f2 (patch) | |
tree | 0594fb88c9da773c1d465fab7a4e56c2c1a1d91a /src/controller.c | |
parent | 65892d6abe7d054499bd6cbfe36d991885466ec0 (diff) | |
download | rspamd-526afdf95a5ab8a12a96c3095501265077ff24f2.tar.gz rspamd-526afdf95a5ab8a12a96c3095501265077ff24f2.zip |
Return statfiles stats from controller.
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/controller.c b/src/controller.c index 16651ea0b..f54d0be03 100644 --- a/src/controller.c +++ b/src/controller.c @@ -26,6 +26,7 @@ #include "libserver/dynamic_cfg.h" #include "libutil/rrd.h" #include "libutil/map.h" +#include "libstat/stat_api.h" #include "main.h" #ifdef WITH_GPERF_TOOLS @@ -1255,12 +1256,8 @@ rspamd_controller_handle_stat_common ( struct rspamd_controller_session *session = conn_ent->ud; ucl_object_t *top, *sub; gint i; - guint64 used, total, rev, ham = 0, spam = 0; - time_t ti; + guint64 learned = 0, spam, ham; rspamd_mempool_stat_t mem_st; - struct rspamd_classifier_config *ccf; - struct rspamd_statfile_config *st; - GList *cur_cl, *cur_st; struct rspamd_stat *stat, stat_copy; rspamd_mempool_stat (&mem_st); @@ -1294,8 +1291,6 @@ rspamd_controller_handle_stat_common ( ucl_object_insert_key (top, ucl_object_fromint ( ham), "ham_count", 0, false); ucl_object_insert_key (top, - ucl_object_fromint (stat->messages_learned), "learned", 0, false); - ucl_object_insert_key (top, ucl_object_fromint (stat->connections_count), "connections", 0, false); ucl_object_insert_key (top, ucl_object_fromint (stat->control_connections_count), @@ -1327,15 +1322,11 @@ rspamd_controller_handle_stat_common ( stat->fuzzy_hashes_expired), "fuzzy_expired", 0, false); /* Now write statistics for each statfile */ - cur_cl = g_list_first (session->ctx->cfg->classifiers); - sub = ucl_object_typed_new (UCL_ARRAY); - while (cur_cl) { - ccf = cur_cl->data; - /* XXX: add statistics for the modern system */ - cur_cl = g_list_next (cur_cl); - } + sub = rspamd_stat_statistics (session->ctx->cfg, &learned); ucl_object_insert_key (top, sub, "statfiles", 0, false); + ucl_object_insert_key (top, + ucl_object_fromint (learned), "total_learns", 0, false); if (do_reset) { session->ctx->srv->stat->messages_scanned = 0; |