create RRDs only when --rrd

influxdb
Nils Schneider 2015-03-24 18:48:05 +01:00
parent bd943e4360
commit 629adc13cb
1 changed files with 9 additions and 5 deletions

View File

@ -74,11 +74,12 @@ 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)
script_directory = os.path.dirname(os.path.realpath(__file__)) if params['rrd']:
rrd = RRD(os.path.join(script_directory, 'nodedb'), script_directory = os.path.dirname(os.path.realpath(__file__))
os.path.join(params['destination_directory'], 'nodes')) rrd = RRD(os.path.join(script_directory, 'nodedb'),
rrd.update_database(nodedb['nodes']) os.path.join(params['destination_directory'], 'nodes'))
rrd.update_images() rrd.update_database(nodedb['nodes'])
rrd.update_images()
if __name__ == '__main__': if __name__ == '__main__':
@ -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())