From 20cfcf35686743e01f11aaaa13ddd78383ead7ff Mon Sep 17 00:00:00 2001 From: n Date: Sun, 27 Feb 2022 10:20:35 +0100 Subject: [PATCH] add verbose output --- pacer2influxdb.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pacer2influxdb.py b/pacer2influxdb.py index f2635f8..35b5b5b 100755 --- a/pacer2influxdb.py +++ b/pacer2influxdb.py @@ -20,7 +20,8 @@ def main(host='localhost', port=8086, user='root', password='root', dbname='demo ts=0 lastdate=0 - print("last entry is %s, ts is %s" % (lastdate,ts)) + if args.verbose: + print("last entry is %s, ts is %s\n" % (lastdate,ts)) con = lite.connect(dbfile) with con: @@ -46,7 +47,9 @@ def main(host='localhost', port=8086, user='root', password='root', dbname='demo } ] - #print(data) + if args.verbose: + print("writing data for %s" % (mytime)) + db.write_points(data) db.close() @@ -54,6 +57,9 @@ def parse_args(): """Parse the args from main.""" parser = argparse.ArgumentParser( description='Export Pacer data to InfluxDB') + parser.add_argument('--verbose', required=False, + action="store_true", + help='verbose output') parser.add_argument('--host', type=str, required=False, default='localhost', help='hostname of InfluxDB http API')