fix whitespaces, clean up, add minor network info
parent
c0e5edf270
commit
c455a5eb6b
|
@ -83,7 +83,7 @@ class zteRouter:
|
|||
def zteinfo(self):
|
||||
ip = self.ip
|
||||
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), login=self.login)
|
||||
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=wa_inner_version%2Cwan_ipaddr%2Cwan_apn%2Ccell_id%2Cnr5g_action_band%2CZ5g_rsrq%2CZ5g_rsrp%2CZ5g_rssi%2CZ5g_SINR%2Cnr_multi_ca_scell_info%2Clte_multi_ca_scell_info%2Clte_ca_pcell_band%2Clte_rsrp%2Clte_rsrq%2Clte_rssi%2Clte_snr%2Cmonthly_tx_bytes%2Cmonthly_rx_bytes%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt"%2Cnr_multi_ca_scell_info%2Cnr5g_action_band"
|
||||
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=wa_inner_version%2Cwan_ipaddr%2Cwan_apn%2Cnetwork_type%2Cnr5g_action_band%2CZ5g_rsrq%2CZ5g_rsrp%2CZ5g_rssi%2CZ5g_SINR%2Cnr_multi_ca_scell_info%2Clte_multi_ca_scell_info%2Clte_ca_pcell_band%2Clte_rsrp%2Clte_rsrq%2Clte_rssi%2Clte_snr%2Cmonthly_tx_bytes%2Cmonthly_rx_bytes%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt%2Cnr_multi_ca_scell_info%2Cnr5g_action_band"
|
||||
cookie_pass = cookie
|
||||
|
||||
headers = {
|
||||
|
@ -94,11 +94,11 @@ 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
|
||||
|
@ -111,10 +111,10 @@ class serveInfos(BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
|
||||
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("zte_modem_info{firmware=\"%s\"," % gatheredJson["wa_inner_version"], "utf-8"))
|
||||
self.wfile.write(bytes("ip_addr=\"%s\"," % gatheredJson["wan_ipaddr"], "utf-8"))
|
||||
self.wfile.write(bytes("apn=\"%s\"," % gatheredJson["wan_apn"], "utf-8"))
|
||||
self.wfile.write(bytes("network_type=\"%s\"} 1\n\n" % gatheredJson["network_type"], "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("# HELP zte_snr Signal-to-Interference-plus-Noise Ratio\n# TYPE zte_snr gauge\n", "utf-8"))
|
||||
|
@ -127,13 +127,13 @@ class serveInfos(BaseHTTPRequestHandler):
|
|||
|
||||
self.wfile.write(bytes("zte_rsrp{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "utf-8"))
|
||||
self.wfile.write(bytes("%s\n" % gatheredJson["Z5g_rsrp"], "utf-8"))
|
||||
|
||||
|
||||
self.wfile.write(bytes("zte_rssi{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "utf-8"))
|
||||
self.wfile.write(bytes("%s\n" % gatheredJson["Z5g_rssi"], "utf-8"))
|
||||
|
||||
self.wfile.write(bytes("zte_snr{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "utf-8"))
|
||||
self.wfile.write(bytes("%s\n\n" % gatheredJson["Z5g_SINR"], "utf-8"))
|
||||
|
||||
|
||||
if gatheredJson['nr_multi_ca_scell_info']:
|
||||
for index, item in enumerate(gatheredJson['nr_multi_ca_scell_info'].split(";")):
|
||||
nrbit = item.split(",")
|
||||
|
@ -156,7 +156,7 @@ class serveInfos(BaseHTTPRequestHandler):
|
|||
|
||||
self.wfile.write(bytes("zte_rsrp{band=\"%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("%s\n" % gatheredJson["lte_rssi"], "utf-8"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue