Added telemetry entries

This commit is contained in:
Mark Qvist 2025-01-25 15:41:08 +01:00
parent 4f201c5615
commit c4cdd388b7

View File

@ -2791,8 +2791,11 @@ class LXMFPropagation(Sensor):
"peers": {} "peers": {}
} }
active_peers = 0
for peer_id in d["peers"]: for peer_id in d["peers"]:
p = d["peers"][peer_id] p = d["peers"][peer_id]
if p["alive"] == True:
active_peers += 1
values["peers"][peer_id] = { values["peers"][peer_id] = {
"type": p["type"], "type": p["type"],
"state": p["state"], "state": p["state"],
@ -2814,6 +2817,9 @@ class LXMFPropagation(Sensor):
"messages_unhandled": p["messages"]["unhandled"], "messages_unhandled": p["messages"]["unhandled"],
} }
values["active_peers"] = active_peers
values["unreachable_peers"] = values["total_peers"] - active_peers
rendered = { rendered = {
"icon": "email-fast-outline", "icon": "email-fast-outline",
"name": "LXMF Propagation", "name": "LXMF Propagation",
@ -2854,6 +2860,8 @@ class LXMFPropagation(Sensor):
f"{topic}/unpeered_propagation_rx_bytes": v["unpeered_propagation_rx_bytes"], f"{topic}/unpeered_propagation_rx_bytes": v["unpeered_propagation_rx_bytes"],
f"{topic}/static_peers": v["static_peers"], f"{topic}/static_peers": v["static_peers"],
f"{topic}/total_peers": v["total_peers"], f"{topic}/total_peers": v["total_peers"],
f"{topic}/active_peers": v["active_peers"],
f"{topic}/unreachable_peers": v["unreachable_peers"],
f"{topic}/max_peers": v["max_peers"], f"{topic}/max_peers": v["max_peers"],
} }