Grafana - issue connecting to InfluxDB 2.0.3 (InfluxQL)

Hi. I’m having an issue when trying to connect to my InfluxDB 2.0.3 instance through Grafana. When attempting to connect using InfluxQL, I get Network Error: (400). When attempting to connect with Flux, the connection works and I can query my buckets, so it doesn’t appear to be an issue with connecting to InfluxDB.

This is on a fresh test install setup specifically to try out Grafana and InfluxDB. I’ve followed this documentation on using Grafana alongside InfluxDB, using the InfluxQL tab’s instructions.

It is very possible that I’m misunderstanding something (I’m new to both Grafana and Influx), but this is how I’ve entered my information:

Query Language: InfluxQL
URL: <influx_url> (tested working with Flux query language)

User (Basic Auth Details): kaden
Password (Basic Auth Details): Auth token (retrieved from InfluxDB > Load Data > Tokens > kaden's Token

Database (InfluxDB Details): Bucket ID (not name) (retrieved from InfluxDB > Load Data > <bucket_id>'s id)
Username (InfluxDB Details: kaden
Password (InfluxDB Details): Same auth token used for Basic Auth Details
HTTP Method: GET

It’s very possible that I’m misunderstanding something, but I’ve tried many combinations of usernames, passwords, I’ve reinstalled quite a few times, but yet nothing. Hopefully I can get some guidance here, thanks in advance :grinning_face_with_smiling_eyes:

2 Likes

please ensure that the network is reachable and reset your passwort and try it again

I’ve confirmed that the network is reachable - as I said, connecting using Flux instead of InfluxQL works fine. I’ve tried both over my public-facing domain, and using the Docker container hostname (http://influxdb:8086), both work for Flux and don’t for InfluxQL.

I’ve reset my database numerous times trying to get this to work, and through then I’ve used different password/usernames, still nothing.

Fixed it. Turns out I needed to include an HTTP Header, key “Authorization”, value “Token myToken”. I have no idea how I was supposed to know this, found no mention of it on the documentation, but it’s possible I missed something.

4 Likes

this is very clar stated so i assumed you made this correct when you said you went trou the manuals

I couldn’t find any mention of these custom HTTP headers, even on the page I linked for the setup guide for InfluxDB 2.0 and Grafana, they reference an image which does not display these headers.

Could you point me to where the docs mention this so I know for future reference? Thanks :grinning_face_with_smiling_eyes:

yes there it is

yes there it is

You might be misunderstanding me - I’m referring to the Custom HTTP Headers, not the Basic Auth.

[quote=“kadenscott, post:8, topic:42757, full:true”]
You might be misunderstanding me - I’m referring to the Custom HTTP Headers, not the Basic Auth.
[/quo
no its all docued

I’m not saying it isn’t, would just like to know where as I didn’t see the requirements for custom HTTP headers referenced anywhere in the documentation, as I clearly missed something.

[quote=“kadenscott, post:10, topic:42757”]
I didn’t see the requirements for custom
[/quote

ok no problem

Fixed it. Turns out I needed to include an HTTP Header, key “Authorization”, value “Token myToken”

Just one say huuugh thanks for this, spend hours looking to get it working and just needed this

Using influxdb 2.0.5 and Grafana 7.4.3
I’m not able make the connection work no matter what I do.

I keep getting InfluxDB Error: Forbidden.

My configurations are:

URL: influx.dns
This dns works, also tried with direct ip.

Access: Server

Header: Authorization Value: Token mytoken

Token was generated by login into the influx UI with the admin user.
I generated a token with de description admin

Database: mydb

I got the DB name by doing the command:

influx v1 dbrp create \
  --bucket-id bucketID \
  --db grafana \
  --rp grafana \
  --default

user: admin
Password: pass

I got this user and pass by running the command:

influx v1 auth create \
  --read-bucket mybucketid \
  --write-bucket mybucketid \
  --username admin

HTTP Method: GET

I can query the DB using the api like this and it works:

curl --get http://localhost:8086/query?db=example-db \
  --header "Authorization: Token YourAuthToken" \
  --data-urlencode "q=SELECT used_percent FROM example-db.example-rp.example-measurement WHERE host=host1"

Those configurations are the suggested ones in the documentation.
I also tried to brute force several combinations trying to find what could be wrong and nothing worked.

Hi Melrose, I have tried all the combination, but still cannot get it works, can you please if you have time help me to set it up? actually I am a newbie. thanks alot.

Hi gentelemen.
I am using InfluxDB 2.1.1 with Grafana 8.3.6.
With Flux activated I am able to access InfluxDB but I am not able to do so with InfluxQL.
I tried everything suggested in this thread without success but possibly I did something wrong.
So can somebody please provide a step by step how to set this up?
Thanks in further.

Had some issues as well with the connection:

find a link to the docs here: InfluxDB v2.2 API documentation

Make sure that when you past your token in the field, you have to include the word Token in front of that. It’s case-sensitive and as the token doesn’t display it’s hidden it might not be so obvious.

Authorization: Token YOUR_INFLUX_TOKEN

1 Like

Many thanks erikvanberkum and kadenscott!!! :grinning: