Cannot connect to datasource InfluxDB

The InfluxDB API is running fine:

$ curl -sl -I http://myserver:8086/ping
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: 6e88a0a0-5288-11e8-a203-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.5.2
X-Request-Id: 6e88a0a0-5288-11e8-a203-000000000000
Date: Tue, 08 May 2018 06:24:15 GMT

But I cannot add InfluxDB as datasource, it keep saying “Network Error: Bad Gateway(502)” when I click “Save & Test”

I leave Auth option blank as by default InfluxDB disables authorization (should it be turned on?)

1 Like

Btw, I’m using docker to run grafana and influxdb:

$ docker ps
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS              PORTS                                                                    NAMES
10a1f272e16b        grafana/grafana                  "/"                4 hours ago         Up 4 hours>3000/tcp                                                   grafana_grafana_1
cc277600039a        timescale/pg_prometheus:master   "docker-entrypoint.s…"   19 hours ago        Up 19 hours>5432/tcp                                                   timescale_timescale_1
9284ef465c2c        chrono_config                    "/ chro…"   22 hours ago        Up 22 hours>8888/tcp                                                   sandbox_chronograf_1
12ce9dacff2b        telegraf:latest                  "/ tele…"   22 hours ago        Up 22 hours         8092/udp, 8125/udp, 8094/tcp                                             sandbox_telegraf_1
dc1a8df2e3a4        ifqld_wait                       "./wait_for_influxdb…"   22 hours ago        Up 22 hours>8093/tcp                                                   sandbox_ifql_1
d0e77fb58886        kapacitor:latest                 "/ kapa…"   22 hours ago        Up 22 hours>9092/tcp                                                   sandbox_kapacitor_1
2c879ce595d8        sandbox_documentation            "/documentation/docu…"   22 hours ago        Up 22 hours>3000/tcp                                                   sandbox_documentation_1
cb1b97db24a5        influxdb:latest                  "/ infl…"   22 hours ago        Up 22 hours>8082/tcp,>8086/tcp,>8089/tcp   sandbox_influxdb_1
1 Like

You should create docker network where grafana and influxdb will be able to reach other.
Or publish app port and use host IP. Or start containers in host mode. Anyway docker networking doc will be good start point for you to understand pros/cons of all options.

1 Like