Hello Anais.
I clicked in “Solution” by mistake in the other thread. ![]()
Thanks for the example.
And sorry for all the questions, I’m really newbie in Python and InfluxDB.
I’m almost there. ![]()
Python code looks to work, however, data were not inserted into InfluxDB.
My code:
from influxdb_client import InfluxDBClient, Point
username = ‘mon360’
password = base64.b64decode(env.INFLUXDBUSRPWD)
database = ‘xxxxxx’
retention_policy = ‘autogen’
bucket = f’{database}/{retention_policy}’client = InfluxDBClient(url=‘xxxxxxxxxx:8086’, token=f’{username}:{password}‘, org=’-‘)
print(’*** Write Points ***')
write_api = client.write_api()v_cpupct = psutil.cpu_percent()
v_curtime = time.strftime(“%Y-%m-%d-T%H:%M:%SZ%z”, time.localtime())point = Point(“SRV_HEATH”).tag(“CUSTOMER”, env.CUSTOMER).tag(“HOSTNAME”, env.HOSTNAME).tag(“RESOURCE”, “CPU”).field(“PCT_USED”, v_cpupct)
print(point.to_line_protocol())write_api.write(bucket=bucket, record=point)
So, there are 3 questions here:
- What is wrong that even without and execution error, no data is written into InfluxDB?
- Where, in the point, the time will be defined to be inserted?
- The example looks to be for a single point insert. How to change it to perform a bulk load?
Many thanks.

