<p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c">File src/osmo-bsc/bts.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c@586">Patch Set #4, Line 586:</a> <code style="font-family:monospace,monospace">      int downtime_seconds = BTS_DOWNTIME_SAMPLE_INTERVAL - uptime_seconds;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Let's back up a bit maybe. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">"Downtime is added to the stat_item. When the statsd system exports these values every X seconds, we have between 0 and X seconds of downtime in that period. Sum up all these periods and you can see total downtime for each BTS during any given timeframe."</p><p style="white-space: pre-wrap; word-wrap: break-word;">Ok so that's the intention of hte new version of the patch. But from what I uderstand reading the code, it looks as if the first time it's indeed going to set the stat to soemthing between 0 and BTS_DOWNTIME_SAMPLE_INTERVAL, but next time this function is called, the item will again be set to 0. So from your grafana or whatever you'll only be able to see the first BTS_DOWNTIME_SAMPLE_INTERVAL of downtime AFAIU.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Now, a proposal from my side would be:<br>What about having a 2 stats "become_up" and "become_down" (feel free to rename it, I put them like this for you to get the idea), which count the transitions down->up and up->down.<br>That means, at any point of time you can now if the BTS is up, or is down (if become_up > become_down, then it's up, otherwise it's down). You can also track uptime/downtime periods by checking the timestamp of when the stat changed value. You can then see easily in a plot like grafana or using python scripts when events happened.</p><p style="white-space: pre-wrap; word-wrap: break-word;">1- BSC starts: become_up=0, become_down=0<br>... a few seconds pas....<br>2- BTS connects: become_up=1, become_down=0<br>... a few hours pass ...<br>3- BTS disconnects: become_up=1, become_down=1<br>... instantaneously or even a few hours later ...<br>4- BTS connects: become_up=2, become_down=1</p><p style="white-space: pre-wrap; word-wrap: break-word;"><br>What do you think? does this proposal fullfill your needs? AFAIU it does fullfill "currently there is no way determine a BTS uptime other than by polling it via the VTY"<br>Do I understand correctly that your target is to put those stats in some persistent/temporary database to be able to plot and find out what's going on over time? then my proposal would work afaiu.<br>The only not "exact" value would be the exact time at which the event happened, where you'd have an error deviation of the number of seconds you configured osmo-bsc to push the stats update, which is usually pretty low, in the order of seconds? Even then, no events are lost, only the timing is a few seconds inaccurate.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/23234">change 23234</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-bsc/+/23234"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c </div>
<div style="display:none"> Gerrit-Change-Number: 23234 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: iedemam <michael@kapsulate.com> </div>
<div style="display:none"> Gerrit-Assignee: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 30 Apr 2021 17:41:33 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: iedemam <michael@kapsulate.com> </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>