Using python socket to Influxdb

Hello,

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

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('10.xxx.xxx.xxx', 8086))   #@ Serveur InfluxDB
....
s.sendall(commande.encode())

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

Thanks

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

        client.write_points(json_body)

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,
https://getkotori.org/docs/about.html