Change in osmo-bsc[master]: stats: Add a stats gauge for the MSC link status.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

ipse gerrit-no-reply at lists.osmocom.org
Wed May 6 23:53:58 UTC 2020


ipse has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18092 )


Change subject: stats: Add a stats gauge for the MSC link status.
......................................................................

stats: Add a stats gauge for the MSC link status.

Change-Id: Ibe4b29056ba704a27b925cfdba49f343ee34f428
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/a_reset.c
M src/osmo-bsc/bsc_init.c
3 files changed, 22 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/92/18092/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 11a4b5f..e85796c 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1554,6 +1554,10 @@
 	bsc_ctr_description,
 };
 
+enum {
+	BSC_STAT_MSC_LINK,
+};
+
 struct gsm_tz {
 	int override; /* if 0, use system's time zone instead. */
 	int hr; /* hour */
@@ -1581,6 +1585,7 @@
 	} hodec2;
 
 	struct rate_ctr_group *bsc_ctrs;
+	struct osmo_stat_item_group *bsc_statg;
 
 	unsigned int num_bts;
 	struct llist_head bts_list;
diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c
index 3f51278..9d7be85 100644
--- a/src/osmo-bsc/a_reset.c
+++ b/src/osmo-bsc/a_reset.c
@@ -71,7 +71,9 @@
 {
 	struct reset_ctx *reset_ctx = (struct reset_ctx *)fi->priv;
 	OSMO_ASSERT(reset_ctx);
+	struct bsc_msc_data *msc = reset_ctx->priv;
 	LOGPFSML(fi, LOGL_NOTICE, "SIGTRAN connection succeeded.\n");
+	osmo_stat_item_set(msc->network->bsc_statg->items[BSC_STAT_MSC_LINK], 1);
 
 	reset_ctx->conn_loss_counter = 0;
 	osmo_fsm_inst_state_chg(fi, ST_CONN, 0, 0);
@@ -86,7 +88,9 @@
 	switch (event) {
 	case EV_N_DISCONNECT:
 		if (reset_ctx->conn_loss_counter >= BAD_CONNECTION_THRESOLD) {
+			struct bsc_msc_data *msc = reset_ctx->priv;
 			LOGPFSML(fi, LOGL_NOTICE, "SIGTRAN connection down, reconnecting...\n");
+			osmo_stat_item_set(msc->network->bsc_statg->items[BSC_STAT_MSC_LINK], 0);
 			osmo_fsm_inst_state_chg(fi, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
 		} else
 			reset_ctx->conn_loss_counter++;
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index 18776f3..9d0ee86 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -44,6 +44,18 @@
 #include <limits.h>
 #include <stdbool.h>
 
+static const struct osmo_stat_item_desc bsc_stat_desc[] = {
+	{ "msc_link", "MSC link status.", "", 16, 0 },
+};
+
+static const struct osmo_stat_item_group_desc bsc_statg_desc = {
+	.group_name_prefix = "bsc",
+	.group_description = "base station controller",
+	.class_id = OSMO_STATS_CLASS_GLOBAL,
+	.num_items = ARRAY_SIZE(bsc_stat_desc),
+	.item_desc = bsc_stat_desc,
+};
+
 int bsc_shutdown_net(struct gsm_network *net)
 {
 	struct gsm_bts *bts;
@@ -268,6 +280,7 @@
 		talloc_free(net);
 		return NULL;
 	}
+	net->bsc_statg = osmo_stat_item_group_alloc(net, &bsc_statg_desc, 0);
 
 	INIT_LLIST_HEAD(&net->bts_rejected);
 	gsm_net_update_ctype(net);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18092
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ibe4b29056ba704a27b925cfdba49f343ee34f428
Gerrit-Change-Number: 18092
Gerrit-PatchSet: 1
Gerrit-Owner: ipse <Alexander.Chemeris at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200506/830e3693/attachment.htm>


More information about the gerrit-log mailing list