InfluxDB + Grafana Network Error: Bad Gateway (502)

I am following the guidelines from the documentation for setting up InfluxDB and Grafana. I have tried both installing natively, installing with docker-compose, uninstalling and reinstalling, restarting my machine, etc. When setting up the InfluxDB data source in Grafana, every attempt returns a Network Error: Bad Gateway (502). I’ve scoured the documentation for all technologies involved but could find no solutions. Any suggestions from the community? Thank you!

Hi, welcome to the forum :slight_smile:

Where are you getting the 502 Bad Gateway error? In Grafana? Can you post a screenshot of your data source configuration?

Did you try the k6 docker-compose setup? docker-compose up -d influxdb grafana should bring up a Grafana container already configured with the InfluxDB container as data source. See the documentation.

Try confirming that the InfluxDB container is running by accessing the REPL with docker-compose exec influxdb influx, or with curl -I localhost:8086/ping which should return something like:

HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: 239af07a-8872-11ea-8006-0242ac140003
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.7.9
X-Request-Id: 239af07a-8872-11ea-8006-0242ac140003
Date: Mon, 27 Apr 2020 10:30:39 GMT

This curl command should also work if running natively.

Was having the same problem following the k6 documentation. Following on from imiric’s reply I could ping to influxdb no problem and it was Grafana throwing the bad gateway error. I changed the url in grafana from:

http://localhost:8086

to:

http://localhost:8086/

Appending the ‘/’ to the url fixed my issue

1 Like

/slash was honey for me as well :slight_smile: