Hello,
I have the same a problem of “Error reading InfluxDB” when trying to add InfluxDB 2.0 Data Source with Flux Query Language
As depicted here - but it didn’t help me:
opened 11:07AM - 23 Mar 21 UTC
closed 03:25PM - 24 Mar 21 UTC
datasource/InfluxDB
needs more info
area/datasource
**What happened**: "Error reading InfluxDB" pop-up raised on clicking "Save and … Test" when adding InfluxDB 2.0 Data Source with "Flux" Query Language. Grafana server log shows "connection refused".
**What you expected to happen**: The connection test to pass without error.
**How to reproduce it (as minimally and precisely as possible)**: Follow the [Configure Grafana to use Flux guide](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/) from InfluxDB.
**Anything else we need to know?**: I have also tried adding an "Authorization" header with value "Token `<influxdb token>`" as detailed [here](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL) but get the same result. I have tried using a default access token with sufficient permissions and an "All access" token to no avail. I have also tried using the org id instead of the org name. I am able to successfully execute a query manually using `curl` from the same machine as the Grafana server, as outlined in the [Influx 2.0 API docs](https://docs.influxdata.com/influxdb/v2.0/query-data/execute-queries/influx-api/) - so I can confirm that influx connection can be made and that the tokens are valid. I am having similar issues setting up the same source using the "InfluxQL" Query Language option, following the [InfluxDB Grafana with InfluxQL guide](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL).
**Environment**:
- Grafana version: v7.4.5 (8a2c78d3f8)
- Data source type & version: InfluxDB Flux (InfluxDB 2.0.4) running as docker container
- OS Grafana is installed on: Debian 10, grafana running as docker container from official image
- User OS & Browser: Debian 10, Google Chrome Version 83.0.4103.97 (Official Build) (64-bit)
- Grafana plugins: None
- Others: N/A
**Data source config**
<img width="362" alt="grafana_data_source" src="https://user-images.githubusercontent.com/17439476/112135220-f158f080-8ba3-11eb-9cc1-b2ee9c7fe02b.PNG">
**Grafana server log**
```
t=2021-03-23T10:51:16+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/ds/query status=400 remote_addr=xxx.xxx.xxx time_ms=48 size=946 referer=http://grafana.staged-by-discourse.com/datasources/edit/1/
t=2021-03-23T10:51:28+0000 lvl=warn msg="Flux query failed" logger=tsdb.influx_flux err="Post \"http://localhost:8086/api/v2/query?org=spiro\": dial tcp 127.0.0.1:8086: connect: connection refused" query=buckets()
```
What was expected to happen?
That the grafana will work with InfluxDB.
Version numbers (grafana, prometheus, graphite, plugins, operating system, etc.):
Configuration information:
influxdb version 2.5.1
grafana 8.4.5
As depicted here - but it didn’t help me:
opened 11:07AM - 23 Mar 21 UTC
closed 03:25PM - 24 Mar 21 UTC
datasource/InfluxDB
needs more info
area/datasource
**What happened**: "Error reading InfluxDB" pop-up raised on clicking "Save and … Test" when adding InfluxDB 2.0 Data Source with "Flux" Query Language. Grafana server log shows "connection refused".
**What you expected to happen**: The connection test to pass without error.
**How to reproduce it (as minimally and precisely as possible)**: Follow the [Configure Grafana to use Flux guide](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/) from InfluxDB.
**Anything else we need to know?**: I have also tried adding an "Authorization" header with value "Token `<influxdb token>`" as detailed [here](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL) but get the same result. I have tried using a default access token with sufficient permissions and an "All access" token to no avail. I have also tried using the org id instead of the org name. I am able to successfully execute a query manually using `curl` from the same machine as the Grafana server, as outlined in the [Influx 2.0 API docs](https://docs.influxdata.com/influxdb/v2.0/query-data/execute-queries/influx-api/) - so I can confirm that influx connection can be made and that the tokens are valid. I am having similar issues setting up the same source using the "InfluxQL" Query Language option, following the [InfluxDB Grafana with InfluxQL guide](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL).
**Environment**:
- Grafana version: v7.4.5 (8a2c78d3f8)
- Data source type & version: InfluxDB Flux (InfluxDB 2.0.4) running as docker container
- OS Grafana is installed on: Debian 10, grafana running as docker container from official image
- User OS & Browser: Debian 10, Google Chrome Version 83.0.4103.97 (Official Build) (64-bit)
- Grafana plugins: None
- Others: N/A
**Data source config**
<img width="362" alt="grafana_data_source" src="https://user-images.githubusercontent.com/17439476/112135220-f158f080-8ba3-11eb-9cc1-b2ee9c7fe02b.PNG">
**Grafana server log**
```
t=2021-03-23T10:51:16+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/ds/query status=400 remote_addr=xxx.xxx.xxx time_ms=48 size=946 referer=http://grafana.staged-by-discourse.com/datasources/edit/1/
t=2021-03-23T10:51:28+0000 lvl=warn msg="Flux query failed" logger=tsdb.influx_flux err="Post \"http://localhost:8086/api/v2/query?org=spiro\": dial tcp 127.0.0.1:8086: connect: connection refused" query=buckets()
```
yosiasz
November 22, 2022, 1:48pm
2
What is your grafana and influxdb hosted on? Docker ?
1 Like
Yes thery are hosted on docker
1 Like
yosiasz
November 22, 2022, 2:26pm
4
Can you access influxdb via browser on port 8086?
In grafana What are you using for authentication to influxdb? User name and password or token?
Hey,
Yes I cab access InfluxDB through port 8086 on google chrome.
In grafana I’ve tried authentication with both:
Username and password of my InfluxDB.
First I try the username as a string and then the username as username id as seen in InfluxDB settings.
I’ve try to use API token ID from InfluxDB. I have influxdb version 2.5.1 so I needed to clone my default token in order to see the API token’s ID. So I put this ID.
I’ve seen in the github post that someone wrote that he guess you should write “token” in the header in HTTP custom Headers, but said nothing about the value…
So i try to put “token” in header and my cloned API token id… didn’t work.
Thanks
Dor
yosiasz
November 22, 2022, 3:45pm
8
that would be your token. just using a fake one here
Is the token value is a very big string with many numbers and characters?
1 Like
So literally write “Token aaabbsc” in Value, of course replacing aaabbsc with my API token id.
Can you please put a picture with all the parameters?
I want to verify I’m doong the fully configuration correctly.
Thanks a lot.
1 Like
yosiasz
November 22, 2022, 6:59pm
12
exactly. I put a picture up on previous post
Great,
Can you please put a picture of all the other parameters in the screen except Custom HTTP header?
I want to verify all the other parameters too.
2 Likes
yosiasz
November 23, 2022, 5:03am
14
No other parameters should be configured other than the host:8086 and this custom header
Still didn’t work
You say I dont need to configure anything in InfluxDB details parameters?
Organization, token, default bucket…leave it blank with nothing written?
What about Access (in HTTP), should it be Server(default)?