InfluxDB Line Protocol

Insert data

GreptimeDB supports HTTP InfluxDB Line protocol. You can write data via /influxdb/write API:

  1. curl -i -XPOST "http://localhost:4000/v1/influxdb/write?db=public&precision=ms" \
  2. --data-binary \
  3. 'monitor,host=127.0.0.1 cpu=0.1,memory=0.4 1667446797450
  4. monitor,host=127.0.0.2 cpu=0.2,memory=0.3 1667446798450
  5. monitor,host=127.0.0.1 cpu=0.5,memory=0.2 1667446798450'

The /influxdb/write supports query params including:

  • db specify which db to write, public by default.
  • precision, precision of timestamps in the line protocol. Accepts ns (nanoseconds), us(microseconds), ms (milliseconds) and s (seconds), nanoseconds by default.

You can also omit the timestamp when sending requests. GreptimeDB will use the current system time (in UTC) of the host machine as the timestamp. For example:

  1. curl -i -XPOST "http://localhost:4000/v1/influxdb/write?db=public&precision=ms" \
  2. --data-binary \
  3. 'monitor,host=127.0.0.1 cpu=0.1,memory=0.4
  4. monitor,host=127.0.0.2 cpu=0.2,memory=0.3
  5. monitor,host=127.0.0.1 cpu=0.5,memory=0.2'

Reference

InfluxDB Line protocol