|
libosmovty
1.0.1
Osmocom VTY library
|
VTY interface for statsd / statistic items. More...
#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>#include <osmocom/core/stats.h>#include <osmocom/core/counter.h>#include <osmocom/core/rate_ctr.h>Macros | |
| #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" |
Functions | |
| static struct osmo_stats_reporter * | osmo_stats_vty2srep (struct vty *vty) |
| static int | set_srep_parameter_str (struct vty *vty, int(*fun)(struct osmo_stats_reporter *, const char *), const char *val, const char *param_name) |
| static int | set_srep_parameter_int (struct vty *vty, int(*fun)(struct osmo_stats_reporter *, int), const char *val, const char *param_name) |
| DEFUN (cfg_stats_reporter_local_ip, cfg_stats_reporter_local_ip_cmd, "local-ip ADDR", "Set the IP address to which we bind locally\ "IP Address\") | |
| DEFUN (cfg_no_stats_reporter_local_ip, cfg_no_stats_reporter_local_ip_cmd, "no local-ip", NO_STR "Set the IP address to which we bind locally\) | |
| DEFUN (cfg_stats_reporter_remote_ip, cfg_stats_reporter_remote_ip_cmd, "remote-ip ADDR", "Set the remote IP address to which we connect\ "IP Address\") | |
| DEFUN (cfg_stats_reporter_remote_port, cfg_stats_reporter_remote_port_cmd, "remote-port <1-65535>", "Set the remote port to which we connect\ "Remote port number\") | |
| DEFUN (cfg_stats_reporter_mtu, cfg_stats_reporter_mtu_cmd, "mtu <100-65535>", "Set the maximum packet size\ "Size in byte\") | |
| DEFUN (cfg_no_stats_reporter_mtu, cfg_no_stats_reporter_mtu_cmd, "no mtu", NO_STR "Set the maximum packet size\) | |
| DEFUN (cfg_stats_reporter_prefix, cfg_stats_reporter_prefix_cmd, "prefix PREFIX", "Set the item name prefix\ "The prefix string\") | |
| DEFUN (cfg_no_stats_reporter_prefix, cfg_no_stats_reporter_prefix_cmd, "no prefix", NO_STR "Set the item name prefix\) | |
| DEFUN (cfg_stats_reporter_level, cfg_stats_reporter_level_cmd, "level (global|peer|subscriber)", "Set the maximum group level\ "Report global groups only\" "Report global and network peer related groups\" "Report global, peer, and subscriber groups\") | |
| DEFUN (cfg_stats_reporter_enable, cfg_stats_reporter_enable_cmd, "enable", "Enable the reporter\) | |
| DEFUN (cfg_stats_reporter_disable, cfg_stats_reporter_disable_cmd, "disable", "Disable the reporter\) | |
| DEFUN (cfg_stats_reporter_statsd, cfg_stats_reporter_statsd_cmd, "stats reporter statsd", CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\) | |
| DEFUN (cfg_stats_interval, cfg_stats_interval_cmd, "stats interval <1-65535>", CFG_STATS_STR "Set the reporting interval\ "Interval in seconds\") | |
| DEFUN (cfg_no_stats_reporter_statsd, cfg_no_stats_reporter_statsd_cmd, "no stats reporter statsd", NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\) | |
| DEFUN (cfg_stats_reporter_log, cfg_stats_reporter_log_cmd, "stats reporter log", CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\) | |
| DEFUN (cfg_no_stats_reporter_log, cfg_no_stats_reporter_log_cmd, "no stats reporter log", NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\) | |
| DEFUN (show_stats, show_stats_cmd, "show stats", SHOW_STR SHOW_STATS_STR) | |
| DEFUN (show_stats_level, show_stats_level_cmd, "show stats level (global|peer|subscriber)", SHOW_STR SHOW_STATS_STR "Set the maximum group level\ "Show global groups only\" "Show global and network peer related groups\" "Show global, peer, and subscriber groups\") | |
| static int | asciidoc_handle_counter (struct osmo_counter *counter, void *sctx_) |
| static void | asciidoc_counter_generate (struct vty *vty) |
| static int | asciidoc_rate_ctr_handler (struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *sctx_) |
| static int | asciidoc_rate_ctr_group_handler (struct rate_ctr_group *ctrg, void *sctx_) |
| static int | asciidoc_osmo_stat_item_handler (struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_) |
| static int | asciidoc_osmo_stat_item_group_handler (struct osmo_stat_item_group *statg, void *sctx_) |
| DEFUN (show_stats_asciidoc_table, show_stats_asciidoc_table_cmd, "show asciidoc counters", SHOW_STR "Asciidoc generation\ "Generate table of all registered counters\") | |
| static int | rate_ctr_group_handler (struct rate_ctr_group *ctrg, void *sctx_) |
| DEFUN (show_rate_counters, show_rate_counters_cmd, "show rate-counters", SHOW_STR "Show all rate counters\) | |
| static int | config_write_stats_reporter (struct vty *vty, struct osmo_stats_reporter *srep) |
| static int | config_write_stats (struct vty *vty) |
| void | osmo_stats_vty_add_cmds () |
| Add stats related commands to the VTY Call this once during your application initialization if you would like to have stats VTY commands enabled. More... | |
Variables | |
| struct host | host |
| struct cmd_node | cfg_stats_node |
| static const struct value_string | stats_class_strs [] |
VTY interface for statsd / statistic items.
This code allows you to register a couple of VTY commands that permit configuration of the Statistics reporting functionality from the VTY.
Use osmo_stats_vty_add_cmds once at application start-up to enable related commands.
| #define CFG_REPORTER_STR "Configure a stats reporter\n" |
| #define CFG_STATS_STR "Configure stats sub-system\n" |
| #define SHOW_STATS_STR "Show statistical values\n" |
|
static |
References asciidoc_handle_counter(), osmo_counters_count(), osmo_counters_for_each(), VTY_NEWLINE, and vty_out().
Referenced by DEFUN().
|
static |
References osmo_counter::description, name, osmo_counter::name, osmo_asciidoc_escape(), VTY_NEWLINE, and vty_out().
Referenced by asciidoc_counter_generate().
|
static |
|
static |
References osmo_stat_item::desc, osmo_stat_item_group::desc, osmo_stat_item_desc::description, osmo_stat_item_group_desc::group_name_prefix, osmo_stat_item_desc::name, name, osmo_asciidoc_escape(), osmo_stat_item_desc::unit, VTY_NEWLINE, and vty_out().
Referenced by asciidoc_osmo_stat_item_group_handler().
|
static |
|
static |
References rate_ctr_group::desc, rate_ctr_desc::description, rate_ctr_group_desc::group_name_prefix, name, rate_ctr_desc::name, osmo_asciidoc_escape(), VTY_NEWLINE, and vty_out().
Referenced by asciidoc_rate_ctr_group_handler().
|
static |
References config_write_stats_reporter(), osmo_stats_config::interval, osmo_stats_reporter_find(), OSMO_STATS_REPORTER_LOG, OSMO_STATS_REPORTER_STATSD, VTY_NEWLINE, and vty_out().
Referenced by osmo_stats_vty_add_cmds().
|
static |
References osmo_stats_reporter::bind_addr_str, osmo_stats_reporter::dest_addr_str, osmo_stats_reporter::dest_port, osmo_stats_reporter::enabled, get_value_string(), osmo_stats_reporter::have_net_config, osmo_stats_reporter::max_class, osmo_stats_reporter::mtu, osmo_stats_reporter::name_prefix, OSMO_STATS_REPORTER_LOG, OSMO_STATS_REPORTER_STATSD, osmo_stats_reporter::type, VTY_NEWLINE, and vty_out().
Referenced by config_write_stats().
| DEFUN | ( | cfg_stats_reporter_local_ip | , |
| cfg_stats_reporter_local_ip_cmd | , | ||
| "local-ip ADDR" | , | ||
| "Set the IP address to which we bind locally\ "IP Address\" | |||
| ) |
References osmo_stats_reporter_set_local_addr(), and set_srep_parameter_str().
| DEFUN | ( | cfg_no_stats_reporter_local_ip | , |
| cfg_no_stats_reporter_local_ip_cmd | , | ||
| "no local-ip" | , | ||
| NO_STR "Set the IP address to which we bind locally\ | |||
| ) |
References osmo_stats_reporter_set_local_addr(), and set_srep_parameter_str().
| DEFUN | ( | cfg_stats_reporter_remote_ip | , |
| cfg_stats_reporter_remote_ip_cmd | , | ||
| "remote-ip ADDR" | , | ||
| "Set the remote IP address to which we connect\ "IP Address\" | |||
| ) |
References osmo_stats_reporter_set_remote_addr(), and set_srep_parameter_str().
| DEFUN | ( | cfg_stats_reporter_remote_port | , |
| cfg_stats_reporter_remote_port_cmd | , | ||
| "remote-port <1-65535>" | , | ||
| "Set the remote port to which we connect\ "Remote port number\" | |||
| ) |
References osmo_stats_reporter_set_remote_port(), and set_srep_parameter_int().
| DEFUN | ( | cfg_stats_reporter_mtu | , |
| cfg_stats_reporter_mtu_cmd | , | ||
| "mtu <100-65535>" | , | ||
| "Set the maximum packet size\ "Size in byte\" | |||
| ) |
References osmo_stats_reporter_set_mtu(), and set_srep_parameter_int().
| DEFUN | ( | cfg_no_stats_reporter_mtu | , |
| cfg_no_stats_reporter_mtu_cmd | , | ||
| "no mtu" | , | ||
| NO_STR "Set the maximum packet size\ | |||
| ) |
References osmo_stats_reporter_set_mtu(), and set_srep_parameter_int().
| DEFUN | ( | cfg_stats_reporter_prefix | , |
| cfg_stats_reporter_prefix_cmd | , | ||
| "prefix PREFIX" | , | ||
| "Set the item name prefix\ "The prefix string\" | |||
| ) |
References osmo_stats_reporter_set_name_prefix(), and set_srep_parameter_str().
| DEFUN | ( | cfg_no_stats_reporter_prefix | , |
| cfg_no_stats_reporter_prefix_cmd | , | ||
| "no prefix" | , | ||
| NO_STR "Set the item name prefix\ | |||
| ) |
References osmo_stats_reporter_set_name_prefix(), and set_srep_parameter_str().
| DEFUN | ( | cfg_stats_reporter_enable | , |
| cfg_stats_reporter_enable_cmd | , | ||
| "enable" | , | ||
| "Enable the reporter\ | |||
| ) |
References CMD_SUCCESS, CMD_WARNING, OSMO_ASSERT, osmo_stats_reporter_enable(), osmo_stats_vty2srep(), VTY_NEWLINE, and vty_out().
| DEFUN | ( | cfg_stats_reporter_disable | , |
| cfg_stats_reporter_disable_cmd | , | ||
| "disable" | , | ||
| "Disable the reporter\ | |||
| ) |
References CMD_SUCCESS, CMD_WARNING, OSMO_ASSERT, osmo_stats_reporter_disable(), osmo_stats_vty2srep(), VTY_NEWLINE, and vty_out().
| DEFUN | ( | cfg_stats_reporter_statsd | , |
| cfg_stats_reporter_statsd_cmd | , | ||
| "stats reporter statsd" | , | ||
| CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\ | |||
| ) |
| DEFUN | ( | cfg_stats_interval | , |
| cfg_stats_interval_cmd | , | ||
| "stats interval <1-65535>" | , | ||
| CFG_STATS_STR "Set the reporting interval\ "Interval in seconds\" | |||
| ) |
References CMD_SUCCESS, CMD_WARNING, osmo_stats_set_interval(), VTY_NEWLINE, and vty_out().
| DEFUN | ( | cfg_no_stats_reporter_statsd | , |
| cfg_no_stats_reporter_statsd_cmd | , | ||
| "no stats reporter statsd" | , | ||
| NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\ | |||
| ) |
| DEFUN | ( | cfg_stats_reporter_log | , |
| cfg_stats_reporter_log_cmd | , | ||
| "stats reporter log" | , | ||
| CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\ | |||
| ) |
| DEFUN | ( | cfg_no_stats_reporter_log | , |
| cfg_no_stats_reporter_log_cmd | , | ||
| "no stats reporter log" | , | ||
| NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\ | |||
| ) |
| DEFUN | ( | show_stats | , |
| show_stats_cmd | , | ||
| "show stats" | , | ||
| SHOW_STR | SHOW_STATS_STR | ||
| ) |
References CMD_SUCCESS, and vty_out_statistics_full().
| DEFUN | ( | show_stats_level | , |
| show_stats_level_cmd | , | ||
| "show stats level (global|peer|subscriber)" | , | ||
| SHOW_STR SHOW_STATS_STR "Set the maximum group level\ "Show global groups only\" "Show global and network peer related groups\" "Show | global, | ||
| peer | , | ||
| and subscriber groups\n" | |||
| ) |
References CMD_SUCCESS, get_string_value(), level, and vty_out_statistics_partial().
| DEFUN | ( | show_stats_asciidoc_table | , |
| show_stats_asciidoc_table_cmd | , | ||
| "show asciidoc counters" | , | ||
| SHOW_STR "Asciidoc generation\ "Generate table of all registered counters\" | |||
| ) |
| DEFUN | ( | show_rate_counters | , |
| show_rate_counters_cmd | , | ||
| "show rate-counters" | , | ||
| SHOW_STR "Show all rate counters\ | |||
| ) |
References CMD_SUCCESS, rate_ctr_for_each_group(), and rate_ctr_group_handler().
|
static |
References CFG_STATS_NODE, vty::index, and vty::node.
Referenced by DEFUN(), set_srep_parameter_int(), and set_srep_parameter_str().
| void osmo_stats_vty_add_cmds | ( | ) |
Add stats related commands to the VTY Call this once during your application initialization if you would like to have stats VTY commands enabled.
References CFG_STATS_NODE, CONFIG_NODE, config_write_stats(), install_element(), install_element_ve(), and install_node().
|
static |
References rate_ctr_group::desc, rate_ctr_group_desc::group_description, rate_ctr_group::idx, VTY_NEWLINE, vty_out(), and vty_out_rate_ctr_group_fmt().
Referenced by DEFUN().
|
static |
References CMD_SUCCESS, CMD_WARNING, OSMO_ASSERT, osmo_stats_vty2srep(), VTY_NEWLINE, and vty_out().
Referenced by DEFUN().
|
static |
References CMD_SUCCESS, CMD_WARNING, OSMO_ASSERT, osmo_stats_vty2srep(), VTY_NEWLINE, and vty_out().
Referenced by DEFUN().
| struct cmd_node cfg_stats_node |
|
static |