Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====================

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
click==3.3
influxdb==0.1.13
influxdb==2.12.0
11 changes: 7 additions & 4 deletions send-annotation
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
)