AJcodez
AJcodez

Reputation: 34146

Grafana won't connect to InfluxDB

The database, username, and password combination definitely work. The following configuration for grafana doesn't tho.

datasources: {
  influxdb: {
    type: 'influxdb',
    url: "http://XXX.XXX.XXX.XX:8086/db/dbname",
    username: 'username',
    password: 'password',
    default: true
  },
},

I've tried removing the default parameter, changing influxdb to influx, and append /series to the url, all to no avail. Has anyone gotten this to work?

Upvotes: 4

Views: 11017

Answers (4)

Joel Griffiths
Joel Griffiths

Reputation: 31

I had the same issue using the config shown by annelorayne above. It turned out that Grafana was not able to connect to localhost:8086, but it could connect to the actual IP address of the server (ie. 10.0.1.100:8086).

This was true even though 'telnet localhost 8086' worked.

I changed the Grafana config to this, and it worked:

  datasources: {
    influxdb: {
      type: 'influxdb',
      url: "http://10.0.1.100:8086/db/collectd",
      username: 'root',
      password: 'root',
      grafanaDB: true
    },
    grafana: {
      type: 'influxdb',
      url: "http://10.0.1.100:8086/db/grafana",
      username: 'root',
      password: 'root'
    },
  },

I'm sorry I can't explain why this happens. Since telnet works, I have to assume it's a Grafana issue.

Upvotes: 2

annelorayne
annelorayne

Reputation: 1484

I'm using this below configuration and it works. Try insert the grafana database into your db and add grafana db configuration.

...

datasources: {

    influxdb: {
      type: 'influxdb',
      url: "http://localhost:8086/db/test",
      username: 'root',
      password: 'XXXX'
    },
    grafana: {
      type: 'influxdb',
      url: "http://localhost:8086/db/grafana",
      username: 'root',
      password: 'XXXX',
      grafanaDB: true
    }
  },

...

Upvotes: 5

kuabhina1702
kuabhina1702

Reputation: 79

The browser sometimes caches the config.js and therefore looks at old configurations. Please try clearing the cache or use incognito/private mode to load grafana dashboard. I faced the same issue and using incognito worked for me.

Verify the config.js contents using grafana( host:port/config.js) .

Upvotes: 0

jvshahid
jvshahid

Reputation: 356

This question has been asked multiple times on the mailing list. See these threads for more info thread1, thread2, thread3. There's also a blog post on how to get grafana and InfluxDB working together here's a link

Upvotes: 0

Related Questions