aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_main.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-08-29 13:31:05 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-09-05 16:24:18 +0200
commit08de290aa8928ce18019c5cc0f85bdf08f27d7bc (patch)
treed4a99ce6573b8e101be524aabecb09cb31bb2da8 /src/osmo-bsc/osmo_bsc_main.c
parent3da59936be660dfc11e393a659ea57cd35a46bb3 (diff)
add stat_items for BTS and TRX connection stati
So far we have stat items per BTS. Add stat items summing overall BTS status. Add stat items: - num_bts:oml_connected - num_bts:all_trx_rsl_connected - num_bts:total - num_trx:rsl_connected - num_trx:total Related: SYS#5542 Related: Ic1b35b7406547f92818afe399a2383d154576409 (osmo-ttcn3-hacks) Change-Id: I2057a798e681a169cc03243a09b3d6449734c010
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_main.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 14cbc2260..395a60e21 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -380,6 +380,18 @@ static void all_ts_dispatch_event(struct gsm_bts_trx *trx, uint32_t event)
}
}
+struct osmo_timer_list update_connection_stats_timer;
+
+/* Periodically call bsc_update_connection_stats() to keep stat items updated.
+ * It would be nicer to trigger this only when OML or RSL state is seen to flip. I tried hard to find all code paths
+ * that should call this and failed to get accurate results; this trivial timer covers all of them. */
+static void update_connection_stats_cb(void *data)
+{
+ bsc_update_connection_stats(bsc_gsmnet);
+ osmo_timer_setup(&update_connection_stats_timer, update_connection_stats_cb, NULL);
+ osmo_timer_schedule(&update_connection_stats_timer, 1, 0);
+}
+
/* Callback function to be called every time we receive a signal from INPUT */
static int inp_sig_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
@@ -1058,6 +1070,8 @@ int main(int argc, char **argv)
signal(SIGUSR2, &signal_handler);
osmo_init_ignore_signals();
+ update_connection_stats_cb(NULL);
+
if (daemonize) {
rc = osmo_daemonize();
if (rc < 0) {