From 08de290aa8928ce18019c5cc0f85bdf08f27d7bc Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 29 Aug 2021 13:31:05 +0200 Subject: 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 --- src/osmo-bsc/osmo_bsc_main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/osmo-bsc/osmo_bsc_main.c') 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) { -- cgit v1.2.3