slight cleanup, add b prefix for lte

main
"Riku" 2024-12-09 13:53:26 +02:00
parent c455a5eb6b
commit b248a65524
1 changed files with 8 additions and 13 deletions

View File

@ -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"))