<p>laforge <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/14937">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">counters-overview: Add a section about the stats reporter<br><br>Fixes: OS#3768<br>Change-Id: Ia338409e6cb1b1478429e3a99158b9d8255dbb2c<br>---<br>M common/chapters/counters-overview.adoc<br>1 file changed, 86 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/common/chapters/counters-overview.adoc b/common/chapters/counters-overview.adoc</span><br><span>index fbdef30..8f9a29a 100644</span><br><span>--- a/common/chapters/counters-overview.adoc</span><br><span>+++ b/common/chapters/counters-overview.adoc</span><br><span>@@ -3,7 +3,7 @@</span><br><span> </span><br><span> The following gives an overview of all the types of counters available:</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-=== Osmo Counters</span><br><span style="color: hsl(120, 100%, 40%);">+=== Osmo Counters (deprecated)</span><br><span> </span><br><span> Osmo counters are the oldest type of counters added to Osmocom projects.</span><br><span> They are not grouped.</span><br><span>@@ -26,12 +26,11 @@</span><br><span> </span><br><span> rate_ctr.per_{sec,min,hour,day,abs}.<group_name>.<idx>.[counter_name]</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-It is possible to get all counters from a group by omitting the counter name</span><br><span style="color: hsl(120, 100%, 40%);">+It is possible to get all counters in a group by omitting the counter name</span><br><span> </span><br><span> === Stat Item</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-Stat items are a grouped replacement for osmo counters, but not many stat</span><br><span style="color: hsl(0, 100%, 40%);">-items are available yet.</span><br><span style="color: hsl(120, 100%, 40%);">+Stat items are a grouped replacement for osmo counters.</span><br><span> </span><br><span> * Printed as part of VTY show stats</span><br><span> * Replacement for osmo counters</span><br><span>@@ -39,12 +38,91 @@</span><br><span> * Grouped and indexed like rate counters</span><br><span> * Items have a unit</span><br><span> * Keeps a list of the last values measured, so could return an average, min,</span><br><span style="color: hsl(0, 100%, 40%);">-  max, std. deviation</span><br><span style="color: hsl(120, 100%, 40%);">+  max, std. deviation. So far this is not implemented in any of the reporting</span><br><span style="color: hsl(120, 100%, 40%);">+  options.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+=== Statistic Levels</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+There are three levels on which a statistic can be aggregated in Osmocom</span><br><span style="color: hsl(120, 100%, 40%);">+projects: globally, per-peer and per-subscriber.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+==== Global</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+These are global statistics.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+==== Peer</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+These statistics relate to a peer the program connects to such as the NSVC in</span><br><span style="color: hsl(120, 100%, 40%);">+an SGSN.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+This level also includes reporting global statistics.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+==== Subscriber</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+These statistics are related to an individual mobile subscriber. An example</span><br><span style="color: hsl(120, 100%, 40%);">+would be bytes transferred in an SGSN PDP context.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+This level also includes global and peer-based statistics.</span><br><span> </span><br><span> === Stats Reporter</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-Statsd stats reporter can send osmo counter, rate counter and stats item values to statsd</span><br><span style="color: hsl(120, 100%, 40%);">+The stats reporter periodically collects osmo counter, rate counter and</span><br><span style="color: hsl(120, 100%, 40%);">+stat item values and sends them to a backend. Currently implemented are</span><br><span style="color: hsl(120, 100%, 40%);">+outputting to the configured log targets and a statsd connector.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-See the stats reporter command of the VTY reference for details on how to</span><br><span style="color: hsl(0, 100%, 40%);">-setup the connection to statsd.</span><br><span style="color: hsl(120, 100%, 40%);">+==== Configuring a stats reporter</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+Periodically printing the statistics to the log can be done in the following</span><br><span style="color: hsl(120, 100%, 40%);">+way:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+.Log statistics</span><br><span style="color: hsl(120, 100%, 40%);">+====</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+----</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC> enable</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC# configure terminal</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config)# stats interval 60 <1></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config)# stats reporter log <2></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# level global <3></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# enable <4></span><br><span style="color: hsl(120, 100%, 40%);">+----</span><br><span style="color: hsl(120, 100%, 40%);">+====</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<1> The interval determines how often the statistics are reported.</span><br><span style="color: hsl(120, 100%, 40%);">+<2> Write the statistic information to any configured log target.</span><br><span style="color: hsl(120, 100%, 40%);">+<3> Report only `global` statistics (can be `global`, `peer`, or</span><br><span style="color: hsl(120, 100%, 40%);">+    `subscriber`).</span><br><span style="color: hsl(120, 100%, 40%);">+<4> Enable the reporter, `disable` will disable it again.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The counter values can also be sent to any aggregation/visualization tool that</span><br><span style="color: hsl(120, 100%, 40%);">+understands the statsd format, for example a statsd server with graphite or</span><br><span style="color: hsl(120, 100%, 40%);">+prometheus using the statsd_exporter together with grafana.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The statsd format is specified in https://github.com/b/statsd_spec</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+.Report statistics to statsd</span><br><span style="color: hsl(120, 100%, 40%);">+====</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+----</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC> enable</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC# configure terminal</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config)# stats interval 10</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config)# stats reporter statsd <1></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# prefix BSC1 <2></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# level subscriber <3></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# remote-ip 1.2.3.4 <4></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# remote-port 8125 <5></span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-stats)# enable</span><br><span style="color: hsl(120, 100%, 40%);">+----</span><br><span style="color: hsl(120, 100%, 40%);">+====</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<1> Configure the statsd reporter.</span><br><span style="color: hsl(120, 100%, 40%);">+<2> Prefix the reported statistics. This is useful to distinguish statistics</span><br><span style="color: hsl(120, 100%, 40%);">+    from multiple instances of the same service.</span><br><span style="color: hsl(120, 100%, 40%);">+<3> Report only `global` statistics or include `peer` or `subscriber`</span><br><span style="color: hsl(120, 100%, 40%);">+    statistics as well.</span><br><span style="color: hsl(120, 100%, 40%);">+<4> IP address of the statsd server.</span><br><span style="color: hsl(120, 100%, 40%);">+<5> UDP port of the statsd server. Statsd by default listens to port 8125.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Setting up a statsd server and configuring the visualization is beyond the</span><br><span style="color: hsl(120, 100%, 40%);">+scope of this document.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/14937">change 14937</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/14937"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-manuals </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia338409e6cb1b1478429e3a99158b9d8255dbb2c </div>
<div style="display:none"> Gerrit-Change-Number: 14937 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>