我正在尝试使用以下代码使用 influxdb-python 将 json(见下文)写入 influxDB -
DBclient = client(host, port, user, password, dbname)
influx_data = json.dumps(write_to_influx_json)
print influx_data
# Writing Data in Influx
DBclient.write_points(influx_data)
JSON -
[{
"fields": [{
"PATH": "/",
"DISK_USED_PERCENT": "10"
}, {
"PATH": "/xxxxxxxxx",
"DISK_USED_PERCENT": "0"
}, {
"PATH": "/dev/xxxxxxxxx",
"DISK_USED_PERCENT": "0"
}, {
"PATH": "/xxxxxxxxx",
"DISK_USED_PERCENT": "3"
}, {
"PATH": "/sys/xxxxxxxxx/xxxxxxxxx",
"DISK_USED_PERCENT": "0"
}, {
"PATH": "/run/xxxxxxxxx",
"DISK_USED_PERCENT": "0"
}, {
"PATH": "xxxxxxxxx",
"DISK_USED_PERCENT": "0"
}],
"tags": {
"host_identifier": "xxxxxx",
"name": "mount_point_percentage"
},
"time": "xxxxx",
"measurement": "xxxxxxx"
}]
但我不断收到以下错误 -
AttributeError: 'str' object has no attribute 'get'
有人可以指出我正确的方向。