Grafana unable to connect to native (non-Docker) InfluxDB on localhost - Network Error: Bad Gateway(502)

I’m using Ubuntu 18.10 with InfluxDB 1.7.4.

I’ve installed Grafana 6.0.0-beta3 as per the installation instructions:

echo "deb https://packages.grafana.com/oss/deb beta main" >> /etc/apt/sources.list.d/grafana.list
curl https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt update
sudo apt install grafana
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo /bin/systemctl start grafana-serve

I’m then trying to add InfluxDB on localhost as a data-source in Grafana.

However, it keeps giving me Network Error: Bad Gateway(502).

I can confirm I’m able to curl http://localhost:8006/ping from the host itself. It’s all running natively (i.e. not containers) on the same host, so not sure what’s going on here?

Any ideas what’s going on?

You’ll want to use port 8086 to connect to influxdb. Here’s a screenshot of an influxdb datasource I use:

I have the same issue and the error I find in the grafana.log is :
failed to open listener on address 192.168.1.245:3000: listen tcp 192.168.1.245:3000: bind: address already in use"

Basically the issue doesn’t seem to be on Influx but on Grafana (port 3000). Influx is setup on port 8086

Looking at what occupies port 3000, it’s …Grafana itself … I even tried another port but the GUI keeps popping up on port 3000 and on the new port ( i configured in the default.ini) , there is an error message.

If Grafana is already using it , why don’t they meet ?

Only thing I noted is the in the netstat the port 3000 is flagged as tcp6 , but it seems to be all internal, then maybe it’s ok.

If you stop Grafana, does netstat show port 3000 still in use? That scenario looks like another instance of Grafana is running on the host, or another process is using it. You can use something like lsof to find out what PID/name is holding onto the port.

The tcp6 from netstat is normal, Grafana will bind to all addresses by default.

One more question - which operating system is this running on?