No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

influx.py 460B

1234567891011121314151617
  1. #!/usr/bin/env python
  2. import aiohttp
  3. import asyncio
  4. influx_host = 'http://INFLUX_DB_IP_HERE:8086'
  5. influx_path = '/write?db=INFLUX_DB_NAME_HERE'
  6. cache = {}
  7. async def async_write(id_tags, name, value):
  8. data = id_tags + " " + name + "=" + str(float(value))
  9. async with aiohttp.ClientSession(influx_host) as session:
  10. await session.post(influx_path, data=data)
  11. def write(id_tags, name, value):
  12. asyncio.run(async_write(id_tags, name, value))