influxdb
influxdb copied to clipboard
Connecting to Grafana - InfluxDB Error: Bad Request
Hi,
I am trying to view Influxdb2 data in Grafana. I use a python script to upload data into influxdb. This is confirmed to be working:

Influxdb is running on the IP shown in the image above. When I try to connect Grafana I get the error IInfluxDB Error: Bad Request
Following the steps in the documentation the url I input into grafana is the same one as in the image above.

The rest of the config is shown in the image below. Both passwords are the admin token and the database is my bucket ID.

Has anyone managed to get a minimum example working between Grafana and Influxdb2 or is there an obvious step I'm missing?
- System info: Linux 5.4.0-65-generic x86_64
- InfluxDB version: 2.0.4
@C-monC I'm not familiar with the Grafana integration, but based on similar issues I've seen I'd recommend trying the instructions I listed at https://github.com/influxdata/kapacitor/issues/2476#issuecomment-775988436 to expose your bucket via our V1 compatibility APIs. You'd then use:
- Database: name of the database you set for your DBRP resource
- Username: name you set for your V1 user
- Password: password you set for your V1 user
If that works for you, could you confirm here? I'll make sure the Grafana-InfluxQL docs get updated to match the steps that work.
I've tried those steps - not sure which parameters must reference new objects and which should be new ones. For instance.
influx v1 dbrp create --org kubOrg --db testdb --rp rp --bucket-id d025cfae0bd77b14 -t asgsgsdfg
--db and --rp would be initialized by that name? Could not find a place to create them in the gui. The bucket is a bucket I've already made.
influx v1 auth create --org kubOrg --username test --password testtest --write-bucket d025cfae0bd77b14
Creating the token does not create a token in the gui but it does return a column which says "name/token"
ID Description Name / Token User Name User ID Permissions
In grafana I then add the datasource. Password testtest

The rest of the configuration - password is again testtest:

What happens if you switch "HTTP Method" to "POST"? We've seen strange failures when using GET (#20713)
If you have control over the server deployment, you could also run influxd --log-level debug to (hopefully) get some tracing logs on the server-side. If switching the HTTP Method doesn't work, could you paste any logs you can find here?
Any update on this? Having same issue.
I have the same issue. Is there any newer Information?
Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token <yourToken>" important is the Space between the Word Token and your Token.
Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token " important is the Space between the Word Token and your Token.
Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
I can confirm that this also fixed it for me. The token is created or copied from influxdb web console, then added as a custom http header in grafana datasource config as per instructions on the link above.
Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token " important is the Space between the Word Token and your Token. Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
I can confirm that this also fixed it for me. The token is created or copied from influxdb web console, then added as a custom http header in grafana datasource config as per instructions on the link above.
This didn't work for me. After generating a token and pasting it in Custom HTTP Headers with the right format (space between "Token" and <My_Token>) I'm still getting a Bad Request error.

Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token " important is the Space between the Word Token and your Token.
Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
I was having the exact same issue and this fix also worked for me. I also continued using the GET http method, not sure if that had anything to do with it.
The process for connecting Grafana to InfluxDB 2.x and using InfluxQL is documented here: https://docs.influxdata.com/influxdb/v2.1/tools/grafana/?t=InfluxQL
Issue resolved for me as well
Format will be like : Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Note: You have to write token space and then actual token value
Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token " important is the Space between the Word Token and your Token.
Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
牛逼!
You can also roll back to v1.8.4 to fix this problem. https://stackoverflow.com/a/66732230/8712494
@hzlRises 确实牛逼!
Use Custom HTTP Header an not "Basic auth" Header = "Authorization" Value ="Token " important is the Space between the Word Token and your Token.
Found on http://wiki.webperfect.ch/index.php?title=InfluxDB_2.x:_Error:Bad_Request(Grafana_and_InfluxQL)&oldid=2578
You absolute legend!!! Thank you! That space makes complete sence, just annoying how the value is star'd out so you think it's just the API key it required! "header" "token api_key" with a space. You sir, are amazing.
Wow, I'm shocked this worked. Great job.
Does that impossible to fix this error? Just like 💩!