fix CA information, add 4G CA (untested)
parent
16120ff286
commit
c0e5edf270
|
@ -83,7 +83,7 @@ class zteRouter:
|
||||||
def zteinfo(self):
|
def zteinfo(self):
|
||||||
ip = self.ip
|
ip = self.ip
|
||||||
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), login=self.login)
|
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%2Clte_rssi%2CZ5g_rssi%2Clte_rsrp%2CZ5g_rsrp%2Clte_rsrq%2CZ5g_rsrq%2Clte_snr%2CZ5g_SINR%2Csignalbar%2Ccell_id%2Cnr5g_action_band%2Ccell_id%2Cnetwork_provider%2Cmonthly_tx_bytes%2Cmonthly_rx_bytes%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt%2Cwan_ipaddr%2Cwan_apn%2Clte_multi_ca_scell_sig_info%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%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"
|
||||||
cookie_pass = cookie
|
cookie_pass = cookie
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -110,9 +110,6 @@ class serveInfos(BaseHTTPRequestHandler):
|
||||||
self.send_header("Content-type", "text/plain")
|
self.send_header("Content-type", "text/plain")
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
#self.wfile.write(bytes("\n\n%s\n\n" % json.dumps(gatheredJson, indent=4), "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("# 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("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\",apn=\"" % gatheredJson["wan_ipaddr"], "utf-8"))
|
||||||
|
@ -124,7 +121,7 @@ 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("# HELP zte_rsrq Reference Signal Received Quality\n# TYPE zte_rsrq gauge\n", "utf-8"))
|
||||||
self.wfile.write(bytes("# HELP zte_rssi Received Signal Strength Indicator\n# TYPE zte_rssi gauge\n", "utf-8"))
|
self.wfile.write(bytes("# HELP zte_rssi Received Signal Strength Indicator\n# TYPE zte_rssi gauge\n", "utf-8"))
|
||||||
|
|
||||||
if gatheredJson['nr_multi_ca_scell_info'] and gatheredJson['nr5g_action_band']:
|
if gatheredJson['nr5g_action_band']:
|
||||||
self.wfile.write(bytes("zte_rsrq{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "utf-8"))
|
self.wfile.write(bytes("zte_rsrq{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "utf-8"))
|
||||||
self.wfile.write(bytes("%s\n" % gatheredJson["Z5g_rsrq"], "utf-8"))
|
self.wfile.write(bytes("%s\n" % gatheredJson["Z5g_rsrq"], "utf-8"))
|
||||||
|
|
||||||
|
@ -137,6 +134,7 @@ class serveInfos(BaseHTTPRequestHandler):
|
||||||
self.wfile.write(bytes("zte_snr{band=\"%s\"} " % gatheredJson["nr5g_action_band"], "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"))
|
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(";")):
|
for index, item in enumerate(gatheredJson['nr_multi_ca_scell_info'].split(";")):
|
||||||
nrbit = item.split(",")
|
nrbit = item.split(",")
|
||||||
if not len(nrbit[0]) == 0:
|
if not len(nrbit[0]) == 0:
|
||||||
|
@ -152,23 +150,34 @@ class serveInfos(BaseHTTPRequestHandler):
|
||||||
self.wfile.write(bytes("zte_snr{band=\"%s\"} " % nrbit[3], "utf-8"))
|
self.wfile.write(bytes("zte_snr{band=\"%s\"} " % nrbit[3], "utf-8"))
|
||||||
self.wfile.write(bytes("%s\n\n" % nrbit[9], "utf-8"))
|
self.wfile.write(bytes("%s\n\n" % nrbit[9], "utf-8"))
|
||||||
|
|
||||||
else:
|
if gatheredJson['lte_ca_pcell_band']:
|
||||||
if gatheredJson["lte_rsrq"]:
|
self.wfile.write(bytes("zte_rsrq{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8"))
|
||||||
self.wfile.write(bytes("zte_rsrq{band=\"lte\"} %s\n" % gatheredJson["lte_rsrq"], "utf-8"))
|
self.wfile.write(bytes("%s\n" % gatheredJson["lte_rsrq"], "utf-8"))
|
||||||
if gatheredJson["Z5g_rsrq"]:
|
|
||||||
self.wfile.write(bytes("zte_rsrq{band=\"5g\"} %s\n" % gatheredJson["Z5g_rsrq"], "utf-8"))
|
self.wfile.write(bytes("zte_rsrp{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8"))
|
||||||
if gatheredJson["lte_rsrp"]:
|
self.wfile.write(bytes("%s\n" % gatheredJson["lte_rsrp"], "utf-8"))
|
||||||
self.wfile.write(bytes("zte_rsrp{band=\"lte\"} %s\n" % gatheredJson["lte_rsrp"], "utf-8"))
|
|
||||||
if gatheredJson["Z5g_rssi"]:
|
self.wfile.write(bytes("zte_rssi{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8"))
|
||||||
self.wfile.write(bytes("zte_rsrp{band=\"5g\"} %s\n" % gatheredJson["Z5g_rssi"], "utf-8"))
|
self.wfile.write(bytes("%s\n" % gatheredJson["lte_rssi"], "utf-8"))
|
||||||
if gatheredJson["lte_rssi"]:
|
|
||||||
self.wfile.write(bytes("zte_snr{band=\"lte\"} %s\n" % gatheredJson["lte_rssi"], "utf-8"))
|
self.wfile.write(bytes("zte_snr{band=\"%s\"} " % gatheredJson["lte_ca_pcell_band"], "utf-8"))
|
||||||
if gatheredJson["Z5g_SINR"]:
|
self.wfile.write(bytes("%s\n\n" % gatheredJson["lte_snr"], "utf-8"))
|
||||||
self.wfile.write(bytes("zte_snr{band=\"5g\"} %s\n" % gatheredJson["Z5g_SINR"], "utf-8"))
|
|
||||||
if gatheredJson["lte_snr"]:
|
if gatheredJson['lte_multi_ca_scell_info']:
|
||||||
self.wfile.write(bytes("zte_snr{band=\"lte\"} %s\n" % gatheredJson["lte_snr"], "utf-8"))
|
for index, item in enumerate(gatheredJson['lte_multi_ca_scell_info'].split(";")):
|
||||||
if gatheredJson["Z5g_SINR"]:
|
cabit = item.split(",")
|
||||||
self.wfile.write(bytes("zte_snr{band=\"5g\"} %s\n\n" % gatheredJson["Z5g_SINR"], "utf-8"))
|
if not len(cabit[0]) == 0:
|
||||||
|
self.wfile.write(bytes("zte_rsrq{band=\"%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("%s\n" % cabit[7], "utf-8"))
|
||||||
|
|
||||||
|
self.wfile.write(bytes("zte_rssi{band=\"%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("%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"))
|
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"))
|
self.wfile.write(bytes("zte_bandwidth_used_monthly_tx %s\n\n" % gatheredJson["monthly_tx_bytes"], "utf-8"))
|
||||||
|
|
Loading…
Reference in New Issue