fix things, move things around

main
"Riku" 2024-09-27 08:47:46 +03:00
parent 73b6f4f79d
commit dfbc4f9922
1 changed files with 20 additions and 11 deletions

View File

@ -107,27 +107,36 @@ class serveInfos(BaseHTTPRequestHandler):
#self.wfile.write(bytes("\n\n%s\n\n" % json.dumps(gatheredJson, indent=4), "utf-8"))
self.wfile.write(bytes("# HELP zte_modem_firmware_version Modem firmware version\n# TYPE zte_modem_firmware_version untyped\n", "utf-8"))
self.wfile.write(bytes("zte_modem_info{firmware=\"%s\",ip_addr=\"" % gatheredJson["wa_inner_version"], "utf-8"))
self.wfile.write(bytes("%s\",apn=\"" % gatheredJson["wan_ipaddr"], "utf-8"))
self.wfile.write(bytes("%s\",cell_id=\"" % gatheredJson["wan_apn"], "utf-8"))
self.wfile.write(bytes("%s\"} 1\n\n" % gatheredJson["cell_id"], "utf-8"))
# for reference for now
#self.wfile.write(bytes("# HELP zte_modem_info Modem general information\n# TYPE zte_modem_info untyped\n", "utf-8"))
#self.wfile.write(bytes("zte_modem_info{firmware=\"%s\",ip_addr=\"" % gatheredJson["wa_inner_version"], "utf-8"))
#self.wfile.write(bytes("%s\",apn=\"" % gatheredJson["wan_ipaddr"], "utf-8"))
#self.wfile.write(bytes("%s\",cell_id=\"" % gatheredJson["wan_apn"], "utf-8"))
#self.wfile.write(bytes("%s\"} 1\n\n" % gatheredJson["cell_id"], "utf-8"))
self.wfile.write(bytes("# HELP zte_modem_wan_ip WAN IP\n# TYPE zte_modem_wan_ip untyped\n", "utf-8"))
self.wfile.write(bytes("zte_modem_wan_ip %s\n\n" % gatheredJson["wan_ipaddr"], "utf-8"))
self.wfile.write(bytes("# HELP zte_modem_firmware Firmware\n# TYPE zte_modem_firmware untyped\n", "utf-8"))
self.wfile.write(bytes("zte_modem_firmware %s\n\n" % gatheredJson["wa_inner_version"], "utf-8"))
self.wfile.write(bytes("# HELP zte_rsrq Reference Signal Received Quality\n# TYPE zte_rsrq gauge\n", "utf-8"))
if gatheredJson["lte_rsrq"] != 0:
if gatheredJson["lte_rsrq"]:
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"))
if gatheredJson["Z5g_rsrq"]:
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"))
if gatheredJson["lte_rsrq"] != 0:
if gatheredJson["lte_rsrp"]:
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"))
if gatheredJson["Z5g_rsrp"]:
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"))
if gatheredJson["lte_rsrq"] != 0:
if gatheredJson["lte_snr"]:
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"))
if gatheredJson["Z5g_SINR"]:
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"))
self.wfile.write(bytes("zte_bandwidth_used_monthly_tx %s\n\n" % gatheredJson["monthly_tx_bytes"], "utf-8"))