Change PLMNStatus and CellGlobalID metrics to int, add PhyCellID
Change-Id: I2bb69a52b587bb72965e1f9ec14e31fcd1b0b39a
diff --git a/edge-monitoring-server/edge_monitoring_server.py b/edge-monitoring-server/edge_monitoring_server.py
index 3fd0212..2096ff6 100755
--- a/edge-monitoring-server/edge_monitoring_server.py
+++ b/edge-monitoring-server/edge_monitoring_server.py
@@ -241,6 +241,12 @@
"ace-menlo-staging": "(Compute)-MP-1-Aether Staging"
}
+plmnstatus_mapping = {
+ "Not Searching": 1,
+ "Searching": 2,
+ "Success": 3
+}
+
# Legacy test status metrics, reporting a status code between -2 and 2
cp_status = prom.Gauge("aetheredge_status_control_plane", "Control plane status code", ["name"])
up_status = prom.Gauge("aetheredge_status_user_plane", "User plane status code", ["name"])
@@ -253,8 +259,9 @@
# Dongle Stats (strings can't be stored in Prometheus)
dongle_stats_imsi = prom.Gauge("aetheredge_dongle_stats_imsi", "IMSI of the UE", ["name"])
-dongle_stats_cellglobalid = prom.Gauge("aetheredge_dongle_stats_cellglobalid", "CellGlobalID of the UE", ["name", "value"])
-dongle_stats_plmnstatus = prom.Gauge("aetheredge_dongle_stats_plmnstatus", "PLMNStatus of the UE", ["name", "value"])
+dongle_stats_cellglobalid = prom.Gauge("aetheredge_dongle_stats_cellglobalid", "CellGlobalID of the UE", ["name"])
+dongle_stats_plmnstatus = prom.Gauge("aetheredge_dongle_stats_plmnstatus", "PLMNStatus of the UE", ["name"])
+dongle_stats_phycellid = prom.Gauge("aetheredge_dongle_stats_phycellid", "PhyCellID of the UE", ["name"])
# Ping dry_run metrics
ping_dry_run_transmitted = prom.Gauge("aetheredge_ping_dry_run_test_transmitted","Last ping test to dry_run number of transmitted packets",["name"])
@@ -409,8 +416,9 @@
try:
dongle_stats_imsi.remove(name)
- dongle_stats_cellglobalid.clear()
- dongle_stats_plmnstatus.clear()
+ dongle_stats_cellglobalid.remove(name)
+ dongle_stats_plmnstatus.remove(name)
+ dongle_stats_phycellid.remove(name)
except:
pass
@@ -488,8 +496,12 @@
try:
dongle_stats_imsi.labels(edge['name']).set(float(edge['dongle_stats']['IMSI']))
- dongle_stats_cellglobalid.labels(name=edge['name'], value=edge['dongle_stats']['CellGlobalID']).set(0)
- dongle_stats_plmnstatus.labels(name=edge['name'], value=edge['dongle_stats']['PLMNStatus']).set(0)
+ dongle_stats_cellglobalid.labels(edge['name']).set(int(edge['dongle_stats']['CellGlobalID'], 16))
+ dongle_stats_phycellid.labels(edge['name']).set(edge['dongle_stats']['PhyCellID'])
+ if edge['dongle_stats']['PLMNStatus'] in plmnstatus_mapping:
+ dongle_stats_plmnstatus.labels(edge['name']).set(plmnstatus_mapping[edge['dongle_stats']['PLMNStatus']])
+ else:
+ dongle_stats_plmnstatus.labels(edge['name']).set(0)
except KeyError:
pass
@@ -585,6 +597,7 @@
res.append(prom.generate_latest(dongle_stats_imsi))
res.append(prom.generate_latest(dongle_stats_cellglobalid))
res.append(prom.generate_latest(dongle_stats_plmnstatus))
+ res.append(prom.generate_latest(dongle_stats_phycellid))
res.append(prom.generate_latest(ping_dry_run_min))
res.append(prom.generate_latest(ping_dry_run_avg))