0

I'm extremely new at k6 + influxdb + grafana, and I was given a task related to execute certain K6 Scripts locally but save/pass the data over a remote InfluxDB instance.

As of now I'm having issues given that I'm not sure what I'm missing regarding the needed configurations in order to do this since everytime I try to run the script pointing at the InfluxDB instance I'm just getting an error everytime I run it:

The command that I'm executing is: k6 run --out influxdb="https://my_influxdb_url/write" //sampleScript.js

But the original URL that was handed over to me was something like this:

https://my_influxdb_url/write?db=DB_NAME&u=USERNAME&p=PASSWORD

And when I execute the first mentioned script I'm getting the following error: ERRO[000X] Couldn't write stats error="404 page not found\n" output=InfluxDB1

So I've tried creating K6_INFLUXDB_USERNAME and K6_INFLUXDB_PASSWORD as environment variables but I'm still getting the same error.

I'm not sure if I might be missing some .yaml file like a datasource in which I should fill those 3 values? (DB_NAME, USERNAME, PASSWORD)

Or maybe I'm just doing it all wrong and not calling the execution command properly for this scenario.

Another weird thing that I noticed is that OUTPUT is throwing InfluxDB1 instead of my actual InfluxDB url which I guess might be where my issue lies.

Any kind of tip would be greatly appreciated since the actual documentation that I've found so far is always run either on a Docker container instance of Grafana+InfluxDB or simply running it locally which is not my case :(

Thanks a lot in advance as always!!

Esepee
  • 87
  • 1
  • 7
  • Does this answer your question? [How to authenticate to influxdb when using k6](https://stackoverflow.com/questions/53765678/how-to-authenticate-to-influxdb-when-using-k6) – Jan Garaj Nov 25 '21 at 10:06
  • @JanGaraj sadly it doesn't :( I've tried both methods shown there and no luck either – Esepee Nov 25 '21 at 11:19
  • You need to have (remote) access to the docker container. If you are not in the same docker network (as is suggested by `my_influxdb_url`), then this container needs to expose its ports and you need to be told the IP or hostname to connect to. – knittl Nov 29 '21 at 17:20

0 Answers0