diff --git a/README.rst b/README.rst index a1df0a8..4e0b31c 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,8 @@ annotate-influxdb Grafana annotations provide a way to mark points on the graph with rich events. When you hover over an annotation you can get title, tags, and text information for the event. This utility is command line tool to send annotation into InfluxDB database. +This has been updated and tested to work with InfluxDB v0.12. If you are using InfluxDB that is older than v0.9, please use version 0.0.1. + Grafana configuration ===================== diff --git a/requirements.txt b/requirements.txt index afede28..490db63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ click==3.3 -influxdb==0.1.13 +influxdb==2.12.0 diff --git a/send-annotation b/send-annotation index 09373bc..f0e478d 100755 --- a/send-annotation +++ b/send-annotation @@ -17,15 +17,18 @@ from influxdb import client as influxdb @click.option('-D', '--description', 'text', help='event description') def cli(db_host, db_port, db_name, user, password, title, tags, text): if text is None: - text = "\n".join([line for line in sys.stdin]) + text = "\n".join([line.rstrip('\n') for line in sys.stdin]) try: db = influxdb.InfluxDBClient(db_host, db_port, user, password, db_name) tags_field = str.join(';', tags) data = [{ - 'name': 'events', - 'columns': ['tags', 'text', 'title'], - 'points': [[tags_field, text, title]] + 'measurement': 'events', + 'fields': { + 'tags': tags_field, + 'title': title, + 'text': text + } }] db.write_points(data) except Exception as e: diff --git a/setup.py b/setup.py index 30b82e4..e077e6b 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ zip_safe=False, long_description='Write annotations (http://grafana.org/docs/features/annotations/) into InfluxDB', install_requires=[ - 'click==3.3', - 'influxdb==0.1.13', + 'click==6.6', + 'influxdb==2.12.0', ], )