create RRDs only when --rrd

This commit is contained in:
Nils Schneider 2015-03-24 18:48:05 +01:00
parent bd943e4360
commit 629adc13cb

View file

@ -74,6 +74,7 @@ def main(params):
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({'batadv': json_graph.node_link_data(batadv_graph)}, f)
if params['rrd']:
script_directory = os.path.dirname(os.path.realpath(__file__)) script_directory = os.path.dirname(os.path.realpath(__file__))
rrd = RRD(os.path.join(script_directory, 'nodedb'), rrd = RRD(os.path.join(script_directory, 'nodedb'),
os.path.join(params['destination_directory'], 'nodes')) os.path.join(params['destination_directory'], 'nodes'))
@ -98,6 +99,9 @@ if __name__ == '__main__':
help='assume MAC to be part of the VPN') help='assume MAC to be part of the VPN')
parser.add_argument('--prune', metavar='DAYS', parser.add_argument('--prune', metavar='DAYS',
help='forget nodes offline for at least 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()) options = vars(parser.parse_args())