Grafana not reading fields from one DB, despite being populated

Hi there,

I am running into a strange problem I don’t undertstand, so I am sure there are people here who are way more skilled than me and can point me to the right solution;-)

I am running Influx 2.75 which I had migrated from 1.8 long ago. After the update, I added some new buckets and enabled Influx 1 Access (according to this post: Unable to connect V1 Clients to InfluxDBV2 - #7 by VlastaHajek) which reportet fine.

Now, I have two instances of Homeassistant, each one populating a different bucket (homeassistant_db and homeassistant2_db). With homeassistant_db everything works fine, I can connect to Grafana and can select all fields.

On homeassistant2_db on the other hand, I can connect the datasource in Grafana, which reports “Datasource connected” but then states “0 measurements”. When checking homeassistant2_db via the Influx Data Explorer, the Data is there. So obviously, Homeassistant is writing the data to the DB in the correct way, but for whatever reason, Grafana cannot read these fields.

Any ideas?


Really, nobody any idea??

@zaphood A few questions:

  • What version of Grafana are you using?
  • What’s your Grafana connection configuration look like for homeassistant2_db?
  • Are you using InfluxQL or Flux?

Hi Scott,

I am using Grafana 10.4.1. Connection is made using Username & PW (same User and PW that works for homeassistant_db and should have the same rights to homeassistant2_db), hope I understood this question correct?.

I’d like to use InfluxQL, but as Grafana states that there a 2 measures, so I am not at this point.

The choice between InfluxQL and Flux changes the way Grafana connects to InfluxDB v2. Flux uses the /api/v2/ endpoint which requires a token to authenticate and won’t work with a username/password. With InfluxQL, there a few different ways to authenticate (basic auth, token, user/pass query params).

Edit: InfluxQL also requires you to map database and retention policy combinations to a v2 bucket. If you migrated from v1 to v2 using the automated migration process, these were added for you. But for your new bucket, you’d have to create the mappings manually:

Scott, mind reading my first post, second paragraph, please?

All you wrote has been set up already. V1 Access and DBRP Mapping has been done and Influx responded with no errors.

homeassistant_db and homeassistant2_db have both been created AFTER the migration (migrated ones carry a "/autogen in their names). One works, the the other doesn’t, makes no sense to me.

Connection can be established, but Grafana can’t see ANY fields in the DB

Looking up the DB content in the Data Explorer, I can see all the fields (and they have data) I can’t see in Grafana

If you have the v2 influx CLI install, can you return the output of the following commands (just as a sanity check):

influx v1 dbrp list


influx v1 auth list

Also–I’m sure it is, but just asking–is your homeassistant2_db connection configuration identical to your homeassistant_db configuration other than the database name?

Authentication uses identical configs / credentials on both DB (basic auth)

influx v1 dbrp list:

ID			Database		Bucket ID		Retention Policy	Default	Organization ID
09dbe251f2c9e000	openhab_db		bf1c287012430b7f	autogentrue	MYORGID
09dbe25a7b89e000	iobroker_db		2bc1b3cfafea3a21	autogentrue	MYORGID
09dbe25bf789e000	gw1bco_db		1ce492dfc1fd3717	autogentrue	MYORGID
09e3cabc96a31000	iobroker2_db		e9be143c620ebed0	defaulttrue	MYORGID
0cd9e854a34f9000	homeassistant2_db	572a18d2dd9283be	defaulttrue	MYORGID

ID			Database		Bucket ID		Retention Policy	Default	Organization ID
02ed00f157e44bbf	_monitoring		02ed00f157e44bbf	autogentrue	MYORGID
8749ff6d8d6528cc	_tasks			8749ff6d8d6528cc	autogentrue	MYORGID
3b0e2e472df2ba74	bco_db			3b0e2e472df2ba74	autogentrue	MYORGID
572a18d2dd9283be	homeassistant2_db	572a18d2dd9283be	autogenfalse	MYORGID
08f829c773efdf36	homeassistant_db	08f829c773efdf36	autogentrue	MYORGID
e9be143c620ebed0	iobroker2_db		e9be143c620ebed0	autogenfalse	MYORGID

influx v1 auth list

ID			Description		Username	v2 User Name	v2 User ID		Permissions
09dbe25c3289e000	grafana's Legacy Token	grafana		admin		09dbe2476489e000	[read:orgs/MYORGID/buckets/bf1c287012430b7f read:orgs/MYORGID/buckets/2bc1b3cfafea3a21]
09dbe25c3789e000	gw1bco's Legacy Token	gw1bco		admin		09dbe2476489e000	[read:orgs/MYORGID/buckets/1ce492dfc1fd3717 write:orgs/MYORGID/buckets/1ce492dfc1fd3717]
09dbe25c3889e000	iobroker's Legacy Token	iobroker	admin		09dbe2476489e000	[read:orgs/MYORGID/buckets/2bc1b3cfafea3a21 write:orgs/MYORGID/buckets/2bc1b3cfafea3a21]
09dbe25c3949e000	openhab's Legacy Token	openhab		admin		09dbe2476489e000	[read:orgs/MYORGID/buckets/bf1c287012430b7f write:orgs/MYORGID/buckets/bf1c287012430b7f]
0acbe71b1937d000	                        homeassistant	admin   09dbe2476489e000	[read:orgs/MYORGID/buckets/08f829c773efdf36 write:orgs/MYORGID/buckets/08f829c773efdf36]

Despite the fact, that the commands for enabling V1 authentication and retention policy returned ok, I was never able to see homeassistant2_db in the auth list.

My guess would be, I messed up something with the rights for the DB itself, but not sure how to check this.

Note: I Replaced my real OrgID with MYORGID, which was the same on all outputs.

Ok, looking at the output of these commands, the homeassistant v1 auth doesn’t have permission to read or write to the homeassistant2_db database:

[read:orgs/MYORGID/buckets/08f829c773efdf36 write:orgs/MYORGID/buckets/08f829c773efdf36]

You have a few options:

Option 1

Create a new v1 auth specific to the homeassistant2_db:

influx v1 auth create \
  --read-bucket 572a18d2dd9283be \
  --write-bucket 572a18d2dd9283be \
  --username homeassistant2 \
  --password example-Pa55W0rd

Option 2

  1. Delete the existing homeassistant v1 auth:

    influx v1 auth delete --id 0acbe71b1937d000
  2. Recreate the homeassistant auth with permissions for both buckets:

    influx v1 auth create \
      --read-bucket 08f829c773efdf36 \
      --write-bucket 08f829c773efdf36 \
      --read-bucket 572a18d2dd9283be \
      --write-bucket 572a18d2dd9283be \
      --username homeassistant \
      --password example-Pa55W0rd

Thanks a lot

For whatever reason, I am not able to create the new user of Option 1. The command returns “-org missing”, but it won’t accept any variation of “-o”, “-org” as well as the org name in lower keys or capitals. I don’t know what I am doing wrong…

Are you able to see a list of organizations with influx org list?

Finally, it works. I don’t know what the problem was, but creating a new user homeassistant2, like in your first example, only worked on my PC. On a Mac, it always complained about an invalid Organisation. Maybe something weird with copy & paste into the terminal, I don’t know but I don’t care now :wink:

Needed to add two lines for authentication and the ORG though:

influx v1 auth create \
  --read-bucket 572a18d2dd9283be \
  --write-bucket 572a18d2dd9283be \
  --username homeassistant2 \
  --password example-Pa55W0rd \
  --org BCO

I can now see 450 Measurements in Grafana, as expected in the first place.

Thanks a lot to you, @scott !

1 Like