From b248a65524ee82c00775d900b6729da50e04a9f7 Mon Sep 17 00:00:00 2001 From: Riku Date: Mon, 9 Dec 2024 13:53:26 +0200 Subject: [PATCH] slight cleanup, add b prefix for lte --- zte_exporter.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/zte_exporter.py b/zte_exporter.py index d6fcb5a..a72372e 100644 --- a/zte_exporter.py +++ b/zte_exporter.py @@ -95,11 +95,6 @@ class zteRouter: response = s.get(cmd_url, headers=headers, verify=False) return response.text - def iterateCellInfo(self, str, type): - for f in str: - print (f) - - zteInstance = zteRouter(args.ip, args.username, args.password, args.login) serverPort = args.port @@ -151,32 +146,32 @@ class serveInfos(BaseHTTPRequestHandler): self.wfile.write(bytes("%s\n\n" % nrbit[9], "utf-8")) if gatheredJson['lte_ca_pcell_band']: - self.wfile.write(bytes("zte_rsrq{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) + self.wfile.write(bytes("zte_rsrq{band=\"b%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) self.wfile.write(bytes("%s\n" % gatheredJson["lte_rsrq"], "utf-8")) - self.wfile.write(bytes("zte_rsrp{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) + self.wfile.write(bytes("zte_rsrp{band=\"b%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) self.wfile.write(bytes("%s\n" % gatheredJson["lte_rsrp"], "utf-8")) - self.wfile.write(bytes("zte_rssi{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) + self.wfile.write(bytes("zte_rssi{band=\"b%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) self.wfile.write(bytes("%s\n" % gatheredJson["lte_rssi"], "utf-8")) - self.wfile.write(bytes("zte_snr{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) + self.wfile.write(bytes("zte_snr{band=\"b%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8")) self.wfile.write(bytes("%s\n\n" % gatheredJson["lte_snr"], "utf-8")) if gatheredJson['lte_multi_ca_scell_info']: for index, item in enumerate(gatheredJson['lte_multi_ca_scell_info'].split(";")): cabit = item.split(",") if not len(cabit[0]) == 0: - self.wfile.write(bytes("zte_rsrq{band=\"%s\"} " % cabit[3], "utf-8")) + self.wfile.write(bytes("zte_rsrq{band=\"b%s\"} " % cabit[3], "utf-8")) self.wfile.write(bytes("%s\n" % cabit[8], "utf-8")) - self.wfile.write(bytes("zte_rsrp{band=\"%s\"} " % cabit[3], "utf-8")) + self.wfile.write(bytes("zte_rsrp{band=\"b%s\"} " % cabit[3], "utf-8")) self.wfile.write(bytes("%s\n" % cabit[7], "utf-8")) - self.wfile.write(bytes("zte_rssi{band=\"%s\"} " % cabit[3], "utf-8")) + self.wfile.write(bytes("zte_rssi{band=\"b%s\"} " % cabit[3], "utf-8")) self.wfile.write(bytes("%s\n" % cabit[10], "utf-8")) - self.wfile.write(bytes("zte_snr{band=\"%s\"} " % cabit[3], "utf-8")) + self.wfile.write(bytes("zte_snr{band=\"b%s\"} " % cabit[3], "utf-8")) self.wfile.write(bytes("%s\n\n" % cabit[9], "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"))