Using a brand new install on Ubuntu, it seems that the new-user-setup/python script contains an error.
The Initialise Client and Write Data steps supply a two part Python script that can be pasted into the terminal using Python3, or run as a script.
During this procedure the following error occurs.
Traceback (most recent call last):
File "/home/ubuntu/monitor_scripts/setup_influx.py", line 13, in <module>
write_api = client.write_api(write_options=SYNCHRONOUS)
NameError: name 'client' is not defined
The script that is generated by the pages is as follows:
import influxdb_client, os, time
from influxdb_client import InfluxDBClient, Point, WritePrecision
from influxdb_client.client.write_api import SYNCHRONOUS
token = os.environ.get("INFLUXDB_TOKEN")
org = "My_Data_Org"
url = "http://xxx.xxx.xxx.xxx:8086"
write_client = influxdb_client.InfluxDBClient(url=url, token=token, org=org)
bucket="My_Bucket"
write_api = client.write_api(write_options=SYNCHRONOUS)
for value in range(5):
point = (
Point("measurement1")
.tag("tagname1", "tagvalue1")
.field("field1", value)
)
write_api.write(bucket=bucket, org="QFES_Catalyst", record=point)
time.sleep(1) # separate points by 1 second
client is not defined at any point. Thus, this line fails:
write_api = client.write_api(write_options=SYNCHRONOUS)