Better port stats handling
This commit is contained in:
parent
192f427b35
commit
0a42485318
11
mikrotik.py
11
mikrotik.py
@ -48,8 +48,6 @@ async def scrape_mikrotik(target):
|
||||
|
||||
)
|
||||
|
||||
ports = ",".join([str(j) for j in range(0, 24)])
|
||||
|
||||
mk.talk_sentence(["/interface/print"])
|
||||
res = await mk.read_full_answer()
|
||||
for resp, _, obj in res:
|
||||
@ -74,6 +72,15 @@ async def scrape_mikrotik(target):
|
||||
yield "interface_running", "gauge", int(obj["tx-byte"]), labels
|
||||
yield "interface_actual_mtu", "gauge", obj["actual-mtu"], labels
|
||||
|
||||
mk.talk_sentence(["/interface/ethernet/print"])
|
||||
port_count = 0
|
||||
res = await mk.read_full_answer()
|
||||
for resp, _, obj in res:
|
||||
if resp in ("!trap", "!done"):
|
||||
break
|
||||
port_count += 1
|
||||
ports = ",".join([str(j) for j in range(0, port_count)])
|
||||
|
||||
mk.talk_sentence(["/interface/ethernet/monitor", "=once=", "=numbers=%s" % ports])
|
||||
res = await mk.read_full_answer()
|
||||
for resp, _, obj in res:
|
||||
|
Reference in New Issue
Block a user