From 738d9e22108a8e472458fad42509fd8d96994d6c Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Tue, 6 Oct 2015 15:21:56 +0200 Subject: stats: Add vty_out_stat_item_group This functions dumps a whole stat item group to the VTY. Sponsored-by: On-Waves ehf --- include/osmocom/vty/misc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/misc.h b/include/osmocom/vty/misc.h index db552e77..ad878db2 100644 --- a/include/osmocom/vty/misc.h +++ b/include/osmocom/vty/misc.h @@ -2,6 +2,7 @@ #include #include +#include #include #define VTY_DO_LOWER 1 @@ -10,7 +11,10 @@ char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals, const char *end, int do_lower); void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, - struct rate_ctr_group *ctrg); + struct rate_ctr_group *ctrg); + +void vty_out_stat_item_group(struct vty *vty, const char *prefix, + struct stat_item_group *statg); int osmo_vty_write_config_file(const char *filename); int osmo_vty_save_config_file(void); -- cgit v1.2.3 From 7211fe157e1107d4a9c04a0ecf494a7b9633c400 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 19 Oct 2015 15:11:50 +0200 Subject: stat/vty: Add vty_out_statistics_full to show all statistics This functions shows the state of all osmo_counters, stat_item groups, and counter groups. Sponsored-by: On-Waves ehf --- include/osmocom/vty/misc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/misc.h b/include/osmocom/vty/misc.h index ad878db2..99c2ee68 100644 --- a/include/osmocom/vty/misc.h +++ b/include/osmocom/vty/misc.h @@ -16,5 +16,7 @@ void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, void vty_out_stat_item_group(struct vty *vty, const char *prefix, struct stat_item_group *statg); +void vty_out_statistics_full(struct vty *vty, const char *prefix); + int osmo_vty_write_config_file(const char *filename); int osmo_vty_save_config_file(void); -- cgit v1.2.3 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 --- include/osmocom/vty/stats.h | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 include/osmocom/vty/stats.h (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/stats.h b/include/osmocom/vty/stats.h new file mode 100644 index 00000000..eaf854e5 --- /dev/null +++ b/include/osmocom/vty/stats.h @@ -0,0 +1,3 @@ +#pragma once + +void stats_vty_add_cmds(); -- cgit v1.2.3 From adc900e0e38373193c8451c0310fe742d62c2c8e Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Tue, 20 Oct 2015 19:05:52 +0200 Subject: stats/vty: Add stats configuration This commit provides stats configuration similar to the log configuration. The following vty commands are added to the config node: stats reporter statsd Create/Modify a statsd reporter no stats reporter statsd Remove a statsd reporter To actually configure a reporter, the config-stats node is entered when the "stats reporter" command has succeeded. The following new vty commands are available there: local-ip ADDR Set the IP address to which we bind locally no local-ip Do not bind to a certain IP address remote-ip ADDR Set the remote IP address to which we connect remote-port <1-65535> Set the remote port to which we connect prefix PREFIX Set the item/counter name prefix no prefix Do not use a prefix enable Enable the reporter disable Disable the reporter Sponsored-by: On-Waves ehf --- include/osmocom/vty/command.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index 4eb519f6..890f0d6d 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -75,6 +75,7 @@ enum node_type { SERVICE_NODE, /*!< \brief Service node. */ DEBUG_NODE, /*!< \brief Debug node. */ CFG_LOG_NODE, /*!< \brief Configure the logging */ + CFG_STATS_NODE, /*!< \brief Configure the statistics */ VTY_NODE, /*!< \brief Vty node. */ -- cgit v1.2.3 From fc9533d6c4bde795dc0e18f02f91f54ab92888a2 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 29 Oct 2015 00:55:58 +0100 Subject: stats: Add osmo_ name prefix to identifiers Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob] --- include/osmocom/vty/misc.h | 2 +- include/osmocom/vty/stats.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/misc.h b/include/osmocom/vty/misc.h index 99c2ee68..f3b46dbd 100644 --- a/include/osmocom/vty/misc.h +++ b/include/osmocom/vty/misc.h @@ -14,7 +14,7 @@ void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg); void vty_out_stat_item_group(struct vty *vty, const char *prefix, - struct stat_item_group *statg); + struct osmo_stat_item_group *statg); void vty_out_statistics_full(struct vty *vty, const char *prefix); diff --git a/include/osmocom/vty/stats.h b/include/osmocom/vty/stats.h index eaf854e5..3851b4df 100644 --- a/include/osmocom/vty/stats.h +++ b/include/osmocom/vty/stats.h @@ -1,3 +1,3 @@ #pragma once -void stats_vty_add_cmds(); +void osmo_stats_vty_add_cmds(); -- cgit v1.2.3 From 34eec7da8dd91c2e812863601ca5f787d6589ecb Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 2 Nov 2015 10:50:50 +0100 Subject: vty: Add reserved nodes to enum node_type Currently every time a node is added to enum node_type, this constitutes an ABI change, since _LAST_OSMOVTY_NODE will get incremented accordingly. In this case, every project that adds new node type based on that value will have to be recompiled. This commit adds 4 spare node type values, which can be replaced one-by-one by new real types until they are exhausted to avoid this kind of ABI change. Sponsored-by: On-Waves ehf --- include/osmocom/vty/command.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/osmocom/vty') diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index 890f0d6d..2ef4109e 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -84,6 +84,15 @@ enum node_type { L_NS_NODE, /*!< \brief NS node in libosmo-gb. */ L_BSSGP_NODE, /*!< \brief BSSGP node in libosmo-gb. */ + /* + * When adding new nodes to the libosmocore project, these nodes can be + * used to avoid ABI changes for unrelated projects. + */ + RESERVED1_NODE, /*!< \brief Reserved for later extensions */ + RESERVED2_NODE, /*!< \brief Reserved for later extensions */ + RESERVED3_NODE, /*!< \brief Reserved for later extensions */ + RESERVED4_NODE, /*!< \brief Reserved for later extensions */ + _LAST_OSMOVTY_NODE }; -- cgit v1.2.3