Bad Gateway Errors when connecting Data Sources, e.g. InfluxDB

I think my setup or configuration is wrong.

I have version 6.0.2 installed on a 64-bit machine running Windows 10 (grafana-6.0.2.windows-amd64). I am accessing the internet via a 4G mobile hotspot, which is my only option.

I can run dashboards with TestData, but cannot connect to ANY datasources! The one I need to connect to is InfluxDB.

I keep getting ‘Network Error: Not Found(404)’ or ‘Error 502: Bad Gateway’… or similar. I have tried turning off my firewalls but still no luck.

Would really appreciate some help!

Show us the config you have tried for the influx source

I’ve been trying to install various downloadable dashboards that (I think) have a datasource included… but but just can’t work out what is required of me to set it up!

I’m completely new to this and can’t find ANY explanation of how all this hangs together…

The only change in my config.ini from sample.ini is - “http_port = 8086”

It would be great if I could find some sample data with a username and password to test this out on. At the moment I don’t know whether it’s my setup or I’m just connecting in the wrong way…

Just go into Add Datasource and select Influx and put in the details there. Then click the Test button at the bottom.
If that doesn’t work show us what you have entered.

[Edit] See also the first page of the getting started guide. http://docs.grafana.org/guides/getting_started/

OK… but what details? I can’t find any sample data…

In a week or so I’ll be asked to create a dashboard for real world data but I can’t even find a sample feed to play with…

Well start by getting some real world data into the database, then you will have something to put on the dashboard.

I’m guessing I’m totally way off here… the username and password is my current Grafana login

The data I’m trying to connect to is from the Influx website - Sample data | InfluxDB OSS 1.7 Documentation

Did you go through the process of creating the influx database on your computer? If so then the default port for influx is 8086 so you want http://localhost:8086, not 3000. You don’t need Skip TLS Verify as you are not using https access. The user and pwd are for access to the database so are nothing to do with the grafana ones, so unless you specified them when you setup the db then you don’t need those.

Sorry, I did realise it was 8086… that example was just where I was losing the plot for a while!

“Did you go through the process of creating the influx database on your computer?” I thought InfluxDB was bundled with Grafana? I’m sorry, I don’t quite understand… I was under the impression that I’m just trying to connect to a stream of data?

I don’t know whether influx is packaged with your grafana or not, that might depend on how you installed it. The influx datasource plugin is packaged as standard but that is not the issue. The issue is the influx software itself. On the page you linked to it tells you how to create the database, download the data and write it to the db. Did you do that? If you did then you should be good to go.

[Edit] and no you do not connect Grafana to a stream of data. You connect Grafana to an influx database which has the real world data stored over a period of time (so you can go back and look at historical values).

No I haven’t… will try that now

I followed the instructions from the InfluxDB site - https://docs.influxdata.com/influxdb/v1.7/query_language/data_download/ - and I have finally connected!

From a Windows users’ perspective, it wasn’t clear how I should install and run InfluxDB locally. I have now run influxd and influx from the cmd prompt, and pulled in the data… and have successfully created a datasource!

Many thanks for your help… !

I have the same issue and I tried all those steps and I am still getting the same error. Is there any other way I can get this problem fixed ? I am Grafana v7.1.5

1 Like

Show us how you have configured the datasource.
What happens when you run the influx command line app to connect to the database?
What OS are you running?

1 Like

I’m getting also the same error. I double checked that my source URL is http://localhost:8086 keeps on giving Network Error: Bad Gateway (502).

I have used curl -sL -I http://localhost:8086/ping to check that i get a response from influxDB via HTTP method. So why is grafana not working…

Also for context i’ve used influxdb and grafana on Linux Ubuntu without any issues… #frustrating

The same questions that I asked the previous poster apply. Show us how you have configured the datasource and tell us whether you can access the db using the influx command line client. Also what OS are you using?

Thanks for the quick response. I’m being blocked from adding more than two links… so i’ve omitted all but the most important.

I’m using the tutorial at <insert link here, omitted because of new user restriction>

I’m doing all of the influxdb and grafana things on Windows10.

I’m running Grafana using the “stock standard” docker run -d --name=grafana -p 3000:3000 grafana/grafana

The command i’m running on Windows commandline is the following. with its response.

C:\Users\Rudolph Lombaard>curl -sL -I http://localhost:8086/ping

HTTP/1.1 204 No Content

Content-Type: application/json

Request-Id: 818edc52-f755-11ea-8079-d66a6a4b7be3

X-Influxdb-Build: OSS

X-Influxdb-Version: 1.8.2

X-Request-Id: 818edc52-f755-11ea-8079-d66a6a4b7be3
Date: Tue, 15 Sep 2020 13:15:20 GMT

I can also confirm I ran chronograf and could connect to the telegraf database within seconds of adding it as a Connection using the exact same URL as what 'm using as a datasource URL in Grafana namely http://localhost:8086

LEt me know if you require any other information.

Regards,

Rudolph Lombaard

Attached screenshot of my grafana datasource config

I’ve tried to add the datasource with or without username and basic_auth