introduce GRAPH_VERSION and NODES_VERSION

influxdb
Nils Schneider 2015-04-01 17:58:25 +02:00
parent c9098b1793
commit 7f198980b6
1 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,9 @@ from lib.alfred import Alfred
from lib.batman import Batman from lib.batman import Batman
from lib.rrddb import RRD from lib.rrddb import RRD
NODES_VERSION = 1
GRAPH_VERSION = 1
def main(params): def main(params):
os.makedirs(params['dest_dir'], exist_ok=True) os.makedirs(params['dest_dir'], exist_ok=True)
@ -62,7 +65,7 @@ def main(params):
nodedb = {'nodes': dict()} nodedb = {'nodes': dict()}
# set version we're going to output # set version we're going to output
nodedb['version'] = 1 nodedb['version'] = NODES_VERSION
# update timestamp and assume all nodes are offline # update timestamp and assume all nodes are offline
nodedb['timestamp'] = now.isoformat() nodedb['timestamp'] = now.isoformat()
@ -119,8 +122,11 @@ def main(params):
with open(nodes_fn, 'w') as f: with open(nodes_fn, 'w') as f:
json.dump(nodedb, f) json.dump(nodedb, f)
graph_out = {'batadv': json_graph.node_link_data(batadv_graph),
'version': GRAPH_VERSION}
with open(graph_fn, 'w') as f: with open(graph_fn, 'w') as f:
json.dump({'batadv': json_graph.node_link_data(batadv_graph)}, f) json.dump(graph_out, f)
# optional rrd graphs (trigger with --rrd) # optional rrd graphs (trigger with --rrd)
if params['rrd']: if params['rrd']: