From 8fd3e1b135f4b5c45de92e0bb453130dbfda66d2 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 6 Jan 2017 20:25:07 +0100 Subject: [PATCH] Add firstseen and role to nodelist. This helps creating nice maps only from nodelist.json --- lib/nodelist.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/nodelist.py b/lib/nodelist.py index 15aea63..cb9baa5 100644 --- a/lib/nodelist.py +++ b/lib/nodelist.py @@ -13,12 +13,20 @@ def export_nodelist(now, nodedb): node_out["status"] = dict() node_out["status"]["online"] = node["flags"]["online"] + if "firstseen" in node: + node_out["status"]["firstcontact"] = node["firstseen"] + if "lastseen" in node: node_out["status"]["lastcontact"] = node["lastseen"] if "clients" in node["statistics"]: 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) return {"version": "1.0.1", "nodes": nodelist, "updated_at": now.isoformat()}