From d1f70ed2348f8c60434acbac3f2235c29fbd1949 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 21 Sep 2017 16:15:32 +0200 Subject: Show OML link uptime in vty Save the time when OML link to BTS was established and show it in vty. That's useful when troubleshooting issues like periodic/sporadic BTS restart. Related: SYS#3889 Change-Id: I9e4e8504afe8ca467b68d41826f61654e24d9600 --- src/libbsc/bsc_vty.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/libbsc/bsc_vty.c') diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 3a80f06bc..f1c78c8d8 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -234,6 +235,9 @@ static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l) static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) { struct pchan_load pl; + unsigned long long sec; + struct timespec tp; + int rc; vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, " "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s", @@ -304,8 +308,20 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) paging_pending_requests_nr(bts), bts->paging.available_slots, VTY_NEWLINE); if (is_ipaccess_bts(bts)) { - vty_out(vty, " OML Link state: %s.%s", - bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE); + vty_out(vty, " OML Link state: "); + if (bts->oml_link) { + vty_out(vty, "connected"); + if (bts->uptime) { + rc = clock_gettime(CLOCK_MONOTONIC, &tp); + if (rc == 0) { /* monotonic clock helps to ensure that conversion below is valid */ + sec = (unsigned long long)difftime(tp.tv_sec, bts->uptime); + vty_out(vty, " %llu days %llu hours %llu min. %llu sec.%s", + OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec), + sec % 60, VTY_NEWLINE); + } + } + } else + vty_out(vty, "disconnected.%s", VTY_NEWLINE); } else { vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); e1isl_dump_vty(vty, bts->oml_link); -- cgit v1.2.3