Using python socket to Influxdb


Is it possible to use a socket (Python) to send data to influxDB ?

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('', 8086))   #@ Serveur InfluxDB

We used a socket with Graphite, but does not work under influxDB and I can not find an example with influxDB …


InfluxDB can accept writes over HTTP as well as a number of other protocols, including a UDP socket; TCP sockets are not supported at this time.

You could also write to Telegraf via the socket_listener plugin, which supports TCP, UDP, and Unix sockets, and let Telegraf handle the connection with InfluxDB.

You could use Python to write to any of the supported protocols for either application.

from influxdb import InfluxDBClient

create a user and database in cronograf (easiest approach)

Set these variables

host = “hostname”
port = 8086
user = “user”
password = “password”

The database we created

dbname = “dbname”

Create the InfluxDB object

client = InfluxDBClient(host, port, user, password, dbname)

Write JSON to InfluxDB


From and example on the influx pages, no error trapping shown, and you need to create, in this case,

a jason object.

use cronograf to determine data loaded.

This currently works for me loading data into influxdb. Telegraf is the better option, but not all cases are catered for.

Bonne Chance

PS just discovered this,