Skip to content

Testing the `influxdb` sink

Stephen Wakely edited this page Nov 30, 2022 · 1 revision

Vector supports two versions of InfluxDB

Version 1

The container is run in two stages. First run it to setup the database. Note you need to specify the volume so the data persists over docker runs.

 docker run --rm \
      -e INFLUXDB_DB=db0 \
      -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword \
      -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword \
      -v $PWD:/var/lib/influxdb \
      influxdb:1.8 /init-influxdb.sh

Then run it against the newly setup database.

   docker run --rm \
        -v $PWD:/var/lib/influxdb \
        --name influx1 \
        -p 8086:8086 \
        influxdb:1.8

To query the data:

docker exec -it influx1 influx -database 'db0'

To show all the available series we can query against:

show series

To query a series:

select * from "vector.uptime_seconds"

Note the series name needs to be quoted if it contains special characters such as ..

Here is a sample Sink configuration:

[sinks.influx]
type = "influxdb_metrics"
inputs = ["remap"]
bucket = "boocket"
consistency = "any"
endpoint = "http://localhost:8086/"
database = "db0"
username = "telegraf"
password = "secretpassword"
retention_policy_name = "autogen"
default_namespace = "service"