Add firstseen and role to nodelist. This helps creating nice
maps only from nodelist.jsonmaster
parent
02cddb0f98
commit
8fd3e1b135
|
@ -13,12 +13,20 @@ def export_nodelist(now, nodedb):
|
||||||
node_out["status"] = dict()
|
node_out["status"] = dict()
|
||||||
node_out["status"]["online"] = node["flags"]["online"]
|
node_out["status"]["online"] = node["flags"]["online"]
|
||||||
|
|
||||||
|
if "firstseen" in node:
|
||||||
|
node_out["status"]["firstcontact"] = node["firstseen"]
|
||||||
|
|
||||||
if "lastseen" in node:
|
if "lastseen" in node:
|
||||||
node_out["status"]["lastcontact"] = node["lastseen"]
|
node_out["status"]["lastcontact"] = node["lastseen"]
|
||||||
|
|
||||||
if "clients" in node["statistics"]:
|
if "clients" in node["statistics"]:
|
||||||
node_out["status"]["clients"] = node["statistics"]["clients"]
|
node_out["status"]["clients"] = node["statistics"]["clients"]
|
||||||
|
|
||||||
|
if "role" in node["nodeinfo"]["system"]:
|
||||||
|
node_out["role"] = node["nodeinfo"]["system"]["role"]
|
||||||
|
else:
|
||||||
|
node_out["role"] = "node"
|
||||||
|
|
||||||
nodelist.append(node_out)
|
nodelist.append(node_out)
|
||||||
|
|
||||||
return {"version": "1.0.1", "nodes": nodelist, "updated_at": now.isoformat()}
|
return {"version": "1.0.1", "nodes": nodelist, "updated_at": now.isoformat()}
|
||||||
|
|
Loading…
Reference in New Issue