1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Influxdb write_points throws AttributeError

Discussão em 'Python' iniciado por Stack, Setembro 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on a Python program. I am trying to write a json (see below) into influxDB by using influxdb-python using the below code -

    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"
    }]


    But i keep getting the below error -

    AttributeError: 'str' object has no attribute 'get'


    Can someone please point me in the right direction?

    Continue reading...

Compartilhe esta Página