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!

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.