Influxdb datasource failed to fetch

  • What Grafana version and what operating system are you using?
    10.2.3
  • What are you trying to achieve?
    I am tryng to add a influxdb datasource.
  • How are you trying to achieve it?
    I have a influxdb datasource with data inside:
http://localhost:8086/query?db=nagiosdb&pretty=true&q=show%20series

Running command above gives:

{
    "results": [
        {
            "statement_id": 0,
            "series": [
                {
                    "columns": [
                        "key"
                    ],
                    "values": [
                        [
                            "metrics,command=check-host-alive,crit-fill=none,host=localhost,performanceLabel=pl,service=hostcheck,unit=%,warn-fill=none"
                        ],
                        [
                            "metrics,command=check-host-alive,crit-fill=none,host=localhost,performanceLabel=rta,service=hostcheck,unit=ms,warn-fill=none"
...

I configure add new datasource with url http://localhost:8086, and database name nagiosdb. I did not change the other default values.

  • What happened?
    I click save and test, but show failed to fetch.

  • What did you expect to happen?
    Should add datasource successfully.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?
    https://www.youtube.com/watch?v=KBfAfW-hUNE

I really wish that someone could help me with this matter, I also created an empty database test to try to connect but also failed. I don’t know how I should debug this since there is no other information. If there is any minimal script to connect with a dummy database in influxdb, I would also love to try. I am using influxdb 1.8.10. Thank you very much.

My system is CentOS 7

I am also interested in which situations might lead to failure? Like should connecting to an totally empty database succeed or fail (If is succeed I can’t achieve as well)? Thanks!

Hello,

Did you configured the database name you want to connect to?
image

Regards

Thanks for your reply! Yes I did. I tried my aim database nagiosdb and also the empty database test.

Assuming you correctly configured your bind-address.

Can you configure access-log-path and assure that auth-enable is set to false (or commented), it’s only for the debug. (Both in the [http] part of the /etc/influxdb/influxdb.conf file)

Try to connect and show the access logs please.

Thanks a lot! I followed the instructions to first modify the influxdb.conf file as follows:


Then I restarted influxdb service: service influxdb restart
I tried again to connect in grafana:
(I had tried both the actual ip 172xxx and also localhost for the url)


But I did not see any logs under that path.
Not sure what went wrong (Is it because influxd has no access to the path? This is the home path of my account and I also use root to run certain commands).

I hoped to analyze the packet sent from grafana to influxdb to see what kind of http request that is. I used this command ngrep -d any port 8086.
The outputs are a bit flooded, I guess that comes from my monitor app keep sending data into influxdb (into database nagiosdb). I can’t really filter them all, but it seems that when I click on Save & Test in grafana I don’t identify packets which seems like grafana sending packets to my influxdb. Could this be the problem?

Updated: I stopped my monitor app to stop sending data into influxdb to control the incoming packets. Now I don’t see any traffic at all even though I click Save & Test.

Okay,

You need to create a user if you want to use your base. With auth-enable = false you’ll not have to use a good password to acces via Grafana:

CREATE USER influx WITH PASSWORD 'influx'
GRANT ALL PRIVILEGES ON your_measurement TO influx

Then you can do this
image

but with the credentials. You can use any password to log in with your user since auth-enable is false.

Try this, and let me know if this works :+1:

Regards

Thanks, but sadly it didn’t. I created user influx:


I tried logging in with the new user and it works.

Again I tried in grafana but still failed.

Meanwhile, there is still no traffic to influxdb observed on ngrep.
I think the problem is with grafana instead of influxdb.
When I click on Save&Test, I monitored the website’s traffic through chrome.
In this screenshot, I pressed the button three times and there is three packets which failed named bdffcv*.



I will now try to install grafana on my mac instead of my centos server, and try if it could connect to my influxdb on centos7 successfully.

Pretty interesting…
I installed grafana again on my mac, and it connected successfully!


Is this a bug specific to CentOS? For I tried to install two different versions of grafana on my centos server, and also tried both on the machine itself and with docker environment. Neither worked.

1 Like

I’m not sure if this was covered already, however, did you check your SELinux rules and firewall setup? There’s a non-zero chance that something internal to the OS just decided to block traffic to port 3000.

1 Like

Hey there, I’m currently experiencing the same behavior. I have influxdb:2.7.6 and grafana:10.4.2 running via docker on my Raspberry Pi 3B+ with RaspianOS.

After some time, Grafana seems to struggle to fetch data from the InfluxDB. However, I’m able to access the InfluxDB and I’m also able to see the correct data. It also seems to me that there’s something wrong with Grafana not being able to fetch data from Influx.