mirror of https://gerrit.osmocom.org/libosmocore
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 ehfzecke/ancient/debian6.0
parent
7211fe157e
commit
45513e6040
|
@ -113,6 +113,7 @@ nobase_include_HEADERS += \
|
|||
osmocom/vty/buffer.h \
|
||||
osmocom/vty/command.h \
|
||||
osmocom/vty/logging.h \
|
||||
osmocom/vty/stats.h \
|
||||
osmocom/vty/misc.h \
|
||||
osmocom/vty/telnet_interface.h \
|
||||
osmocom/vty/vector.h \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
void stats_vty_add_cmds();
|
|
@ -9,7 +9,7 @@ if ENABLE_VTY
|
|||
lib_LTLIBRARIES = libosmovty.la
|
||||
|
||||
libosmovty_la_SOURCES = buffer.c command.c vty.c vector.c utils.c \
|
||||
telnet_interface.c logging_vty.c
|
||||
telnet_interface.c logging_vty.c stats_vty.c
|
||||
libosmovty_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
|
||||
libosmovty_la_LIBADD = $(top_builddir)/src/libosmocore.la
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* OpenBSC stats helper for the VTY */
|
||||
/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
|
||||
* (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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/buffer.h>
|
||||
#include <osmocom/vty/vty.h>
|
||||
#include <osmocom/vty/telnet_interface.h>
|
||||
#include <osmocom/vty/misc.h>
|
||||
|
||||
#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);
|
||||
}
|
Loading…
Reference in New Issue