InfluxDB insert multiples values at once using curl

If you have to insert multiples values in an influxdb database. You can use curl and insert the values one at the time.

But there is a better way like in this example

Let’s say you want to insert your tree loadaverage values in you influxdb database.

First put them into variables using these 3 lines.

Then using this curl line, insert them all at once in your influxdb database

2 thoughts on “InfluxDB insert multiples values at once using curl

  1. curl -i -XPOST ‘http://localhost:8086/write?db=database’ –data-binary “loadavg 1min=$onemin,5min=$fivemin,15min=$fifteenmin”
    Above is throwing an error.
    [root@xx-ss-ss_data]# echo $value
    172983
    {“error”:”unable to parse ‘SGSNMME,host=msje01 vale=172983\r’: invalid number”}

    Same command works fine, when I add hard-coded value i.e. 172983 instead of calling it $value.

    Please advise if any further action can be taken.

  2. I see that you have a /r at the end of your value.
    Windows and Linux write the end on line differently. Did you use a windows text editor?
    Try editing your script with something like notepad++ to avoid that type of issue

Leave a Comment

Your email address will not be published. Required fields are marked *