From 629adc13cb0d46158f8393e49141d02b99a8e6b9 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 24 Mar 2015 18:48:05 +0100 Subject: [PATCH] create RRDs only when --rrd --- backend.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/backend.py b/backend.py index 0a91153..2d8cc9a 100755 --- a/backend.py +++ b/backend.py @@ -74,11 +74,12 @@ def main(params): with open(graph_fn, 'w') as f: json.dump({'batadv': json_graph.node_link_data(batadv_graph)}, f) - script_directory = os.path.dirname(os.path.realpath(__file__)) - rrd = RRD(os.path.join(script_directory, 'nodedb'), - os.path.join(params['destination_directory'], 'nodes')) - rrd.update_database(nodedb['nodes']) - rrd.update_images() + if params['rrd']: + script_directory = os.path.dirname(os.path.realpath(__file__)) + rrd = RRD(os.path.join(script_directory, 'nodedb'), + os.path.join(params['destination_directory'], 'nodes')) + rrd.update_database(nodedb['nodes']) + rrd.update_images() if __name__ == '__main__': @@ -98,6 +99,9 @@ if __name__ == '__main__': help='assume MAC to be part of the VPN') parser.add_argument('--prune', metavar='DAYS', help='forget nodes offline for at least DAYS') + parser.add_argument('--rrd', dest='rrd', action='store_true', + default=False, + help='create RRD graphs') options = vars(parser.parse_args())