Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from influxdb import InfluxDBClient
- import datetime
- def annotate():
- _host = 'localhost'
- _port = 8086
- _user = "root"
- _pass = "root"
- _dbname = 'telegraf'
- annotation_body = [
- {
- "measurement": "events",
- "tags": {
- "type": "start"
- "text": "This is the start"
- },
- "time": datetime.datetime.utcnow().isoformat(),
- }
- ]
- client = InfluxDBClient(_host, _port, _user, _pass, _dbname)
- try:
- client.create_database(_dbname)
- except:
- pass
- client.switch_database(_dbname)
- client.switch_user(_user, _pass)
- print annotation_body
- if __name__ == '__main__':
- annotate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement