2

I am using k6 for as a load testing tool and I want to write data to influxdb. It all works fine except I do not know how to send user credentials for influxdb.

Example:

./k6.exe run --out "influxdb=http://localhost:8086/stresstest" script.js --vus 10 --duration 3s

I tried to pass influxdb username and password like this, but it doesn't work

./k6.exe run --out "influxdb=http://localhost:8086/stresstest?u=<USERNAME>&p=<PASSWORD>" script.js --vus 10 --duration 3s

I do not want to disable influxdb auth!

Meliodas
  • 327
  • 2
  • 10

1 Answers1

11

You can pass them as HTTP auth in the InfluxDB URL like this: --out "influxdb=http://<username>:<password>@localhost:8086/stresstest"

Alternatively, you could also specify them via the K6_INFLUXDB_USERNAME and K6_INFLUXDB_PASSWORD environment variables.

na--
  • 1,016
  • 7
  • 9
  • Thanks for the answer. My password is = pass@word. I tried replacing @ with %40 in password but still not working. Any thoughts on this are appreciated. I am running k6 tests at local but my InfluxDB setup is at Azure cloud. – Deepak Apr 26 '23 at 14:19