16 lines
605 B
Python
16 lines
605 B
Python
from datetime import datetime
|
|
|
|
from influxdb_client import InfluxDBClient, Point, WritePrecision
|
|
from influxdb_client.client.write_api import SYNCHRONOUS
|
|
|
|
# You can generate an API token from the "API Tokens Tab" in the UI
|
|
token = "wb4s191jc33JQ4a6wK3ZECwrrG3LuSyQd61akFa_q6ZCEsequUvFhL9Gre6FaZMA2ElCylKz26ByJ6RetkQaGQ=="
|
|
org = "test-org"
|
|
bucket = "test"
|
|
|
|
with InfluxDBClient(url="http://localhost:8086", token=token, org=org) as client:
|
|
write_api = client.write_api(write_options=SYNCHRONOUS)
|
|
data = "mem,host=host1 used_percent=23.43234543"
|
|
write_api.write(bucket, org, data)
|
|
client.close()
|