From 45513e6040195f5494d40a2750de4dac7037593f Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 19 Oct 2015 15:14:13 +0200 Subject: stats/vty: Add stats_vty.c This file will contain the VTY code related to statistics. This commit adds a minimal file with just as single VTY command: - show stats This command shows all statistical values To enable this and future commands, the main program needs to call stats_vty_add_cmds(). Sponsored-by: On-Waves ehf --- src/vty/stats_vty.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/vty/stats_vty.c (limited to 'src/vty/stats_vty.c') diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c new file mode 100644 index 00000000..c19b2259 --- /dev/null +++ b/src/vty/stats_vty.c @@ -0,0 +1,52 @@ +/* OpenBSC stats helper for the VTY */ +/* (C) 2009-2010 by Harald Welte + * (C) 2009-2014 by Holger Hans Peter Freyther + * (C) 2015 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include + +#include "../../config.h" + +#include +#include +#include +#include +#include + +#define CFG_STATS_STR "Configure stats sub-system\n" +#define CFG_REPORTER_STR "Configure a stats reporter\n" + +#define SHOW_STATS_STR "Show statistical values\n" + +DEFUN(show_stats, + show_stats_cmd, + "show stats", + SHOW_STR SHOW_STATS_STR) +{ + vty_out_statistics_full(vty, ""); + + return CMD_SUCCESS; +} + +void stats_vty_add_cmds(const struct log_info *cat) +{ + install_element_ve(&show_stats_cmd); +} -- cgit v1.2.3