From 73b6f4f79dfa12b5e09a92627bac6b0d4e4461a4 Mon Sep 17 00:00:00 2001 From: Ville Granroth Date: Fri, 27 Sep 2024 08:30:01 +0300 Subject: [PATCH] hack for SA compliancy --- zte_exporter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zte_exporter.py b/zte_exporter.py index dfeab12..f25a67b 100644 --- a/zte_exporter.py +++ b/zte_exporter.py @@ -115,15 +115,18 @@ class serveInfos(BaseHTTPRequestHandler): self.wfile.write(bytes("# HELP zte_rsrq Reference Signal Received Quality\n# TYPE zte_rsrq gauge\n", "utf-8")) - self.wfile.write(bytes("zte_rsrq{band=\"lte\"} %s\n" % gatheredJson["lte_rsrq"], "utf-8")) + if gatheredJson["lte_rsrq"] != 0: + self.wfile.write(bytes("zte_rsrq{band=\"lte\"} %s\n" % gatheredJson["lte_rsrq"], "utf-8")) self.wfile.write(bytes("zte_rsrq{band=\"5g\"} %s\n\n" % gatheredJson["Z5g_rsrq"], "utf-8")) self.wfile.write(bytes("# HELP zte_rsrp Reference Signal Received Power\n# TYPE zte_rsrp gauge\n", "utf-8")) - self.wfile.write(bytes("zte_rsrp{band=\"lte\"} %s\n" % gatheredJson["lte_rsrp"], "utf-8")) + if gatheredJson["lte_rsrq"] != 0: + self.wfile.write(bytes("zte_rsrp{band=\"lte\"} %s\n" % gatheredJson["lte_rsrp"], "utf-8")) self.wfile.write(bytes("zte_rsrp{band=\"5g\"} %s\n\n" % gatheredJson["Z5g_rsrp"], "utf-8")) self.wfile.write(bytes("# HELP zte_snr Signal-to-Interference-plus-Noise Ratio\n# TYPE zte_snr gauge\n", "utf-8")) - self.wfile.write(bytes("zte_snr{band=\"lte\"} %s\n" % gatheredJson["lte_snr"], "utf-8")) + if gatheredJson["lte_rsrq"] != 0: + self.wfile.write(bytes("zte_snr{band=\"lte\"} %s\n" % gatheredJson["lte_snr"], "utf-8")) self.wfile.write(bytes("zte_snr{band=\"5g\"} %s\n\n" % gatheredJson["Z5g_SINR"], "utf-8")) self.wfile.write(bytes("# HELP zte_bandwidth_used_monthly_tx Used bandwidth, transmit (bytes)\n# TYPE zte_bandwidth_used_monthly_tx counter\n", "utf-8"))