InfluxDB 1.x: Difference between revisions

From Leo's Notes
This page was last edited on 10 February 2020, at 17:23.
mNo edit summary
Line 15: Line 15:
For multiple entries, write multiple lines separated by a {{code|\n}} newline and POST with Curl like above.
For multiple entries, write multiple lines separated by a {{code|\n}} newline and POST with Curl like above.
{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
$ cat /tmp/measurements | curl -X POST 'http://influxdb/write?db=lsf' --data-binary @-'
$ cat /tmp/measurements {{!}} curl -X POST 'http://influxdb/write?db=lsf' --data-binary @-'
}}
}}

Revision as of 17:23, 10 February 2020

InfluxDB is a time series database written in Go.

Writing Data

The schema of a InfluxDB database is based on the very first initial data types added. Adding additional data with a different type will be rejected.

Curl

Using curl, you can POST values to a particular database using the line protocol. For more information, see https://docs.influxdata.com/influxdb/v0.9/write_protocols/line/

$ curl -X POST 'http://influxdb/write?db=lsf' --data-binary 'measurement,tag1=x,tag2=x recorded_value1=x `date +%s"000000000"`'

For multiple entries, write multiple lines separated by a \n newline and POST with Curl like above.

$ cat /tmp/measurements | curl -X POST 'http://influxdb/write?db=lsf' --data-binary @-'