]> source.dussan.org Git - rspamd.git/commitdiff
* Implement statistic output in control interface
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Sun, 11 Jan 2009 15:53:27 +0000 (18:53 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Sun, 11 Jan 2009 15:53:27 +0000 (18:53 +0300)
src/controller.c

index 2115210e0d20350b71d465740497221415a91978..fb14cf8bbfe33efa397afbf43cd01d722da4ef16 100644 (file)
@@ -161,9 +161,16 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
                        }
                        break;
                case COMMAND_STAT:
-                       /* XXX need to implement stat */
                        if (check_auth (cmd, session)) {
-                               r = snprintf (out_buf, sizeof (out_buf), "-- end of stats report" CRLF);
+                               r = snprintf (out_buf, sizeof (out_buf), "Messages scanned: %u" CRLF,
+                                                         session->worker->srv->stat->messages_scanned);
+                               r += snprintf (out_buf + r, sizeof (out_buf) - r , "Messages learned: %u" CRLF,
+                                                         session->worker->srv->stat->messages_learned);
+                               r += snprintf (out_buf + r, sizeof (out_buf) - r, "Connections count: %u" CRLF,
+                                                         session->worker->srv->stat->connections_count);
+                               r += snprintf (out_buf + r, sizeof (out_buf) - r, "Control connections count: %u" CRLF,
+                                                         session->worker->srv->stat->control_connections_count);
+                               r += snprintf (out_buf + r, sizeof (out_buf) - r, "-- end of stats report" CRLF);
                                bufferevent_write (session->bev, out_buf, r);
                        }
                        break;