Grafana v8.3.3 Setting up InfluxQL (InfluxDB 2.0.3) data source (again)

Hello.
After hours of trial and no success I humbly turn to the experts.
Just after Influx v2 came out some 2 years back, I decided to upgrade, and that broke all my Grafana panels because of the Flux QL becoming default.
(When I originally installed Grafana v4 something and InfluxDB v1.8 everything worked just bang out of the box.)
I am just now re-visiting Grafana because I miss my graphs, but am struggling.

My setup:
I’m using InfluxDB v2.0.3 as persistence storage for my openHab3 setup.
Everything woks fine, and OH3 is set up to use V2 as ‘database version’ (=Flux QL I imagine.)

image denied by forum

OH3 can Analyse single items and that works fine:
image denied by forum

But what fun are single graphs, right?

So enter Grafana v8.3.3, which I want to set up using InfluxQL (v1).
I have tried both the Header Auth method with API token and user/pw with authenticated user, both with the same result:

omr@shs2:~$ influx bucket list
ID                      Name                    Retention       Organization ID
b6a3ceaa4633dd60        _monitoring             168h0m0s        427da286ec49d684
0919e1fd771206a7        _tasks                  72h0m0s         427da286ec49d684
69d6af7550af3294        openhab_db/autogen      0s              427da286ec49d684

omr@shs2:~$ influx v1 dbrp list
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
08c3b4d754a05000        openhab-db      69d6af7550af3294        Forever                 true    427da286ec49d684
08c3b5c681605000        openhab_db      69d6af7550af3294        Forever                 true    427da286ec49d684
08c3bb7cc5b43000        openhab         69d6af7550af3294        Forever                 true    427da286ec49d684
omr@shs2:~$ influx v1 auth list
ID                      Description     Name / Token    User Name       User ID                 Permissions
08c4002beef43000                        openhab         openhab         06f1f3ef50380000        [write:orgs/427da286ec49d684/buckets/69d6af7550af3294]

My latest attempt is using the v1 auth name openhab:
image denied by forum, but it shows that Data source is working

Everything looks fine, but when I Explore, no Measurements are listed:

If I manually enter a known existing measurement and tries the Inspector I get this:

Any pointers as to what to try next are most welcome.

Edit:
Running the query, nothing shows up in sudo tail -F /var/log/grafana/grafana.log so I guess Grafana is happy.

sudo journalctl -u influxdb.service shows:

Jan 16 14:46:57 shs2 influxd[1158]: ts=2022-01-16T13:46:57.259994Z lvl=info msg="executing new query" log_id=0Z3jR4MW000 query="SHOW MEASUREMENTS LIMIT 100"
Jan 16 14:46:57 shs2 influxd[1158]: ts=2022-01-16T13:46:57.260086Z lvl=info msg="Executing query" log_id=0Z3jR4MW000 service=query query="SHOW MEASUREMENTS ON openhab LIMIT 100"
Jan 16 14:46:58 shs2 influxd[1158]: ts=2022-01-16T13:46:58.727749Z lvl=info msg="executing new query" log_id=0Z3jR4MW000 query="SHOW MEASUREMENTS WITH MEASUREMENT =~ /(?i)BathTemperature/ LIMIT 100"
Jan 16 14:46:58 shs2 influxd[1158]: ts=2022-01-16T13:46:58.727875Z lvl=info msg="Executing query" log_id=0Z3jR4MW000 service=query query="SHOW MEASUREMENTS ON openhab WITH MEASUREMENT =~ /(?i)BathTemperature/ WHERE _name =~ /(?i)BathTemperature/ LIMIT 100"
Jan 16 14:47:00 shs2 influxd[1158]: ts=2022-01-16T13:47:00.079622Z lvl=info msg="executing new query" log_id=0Z3jR4MW000 query="SELECT mean(\"value\") FROM \"BathTemperature\" WHERE time >= now() - 1h and time <= now() GROUP BY time(2s) fill(null)"
Jan 16 14:47:00 shs2 influxd[1158]: ts=2022-01-16T13:47:00.079904Z lvl=info msg="Executing query" log_id=0Z3jR4MW000 service=query query="SELECT mean(value) FROM openhab.Forever.BathTemperature WHERE time >= now() - 1h AND time <= now() GROUP BY time(2s)"
Jan 16 14:47:01 shs2 influxd[1158]: ts=2022-01-16T13:47:01.759300Z lvl=info msg="executing new query" log_id=0Z3jR4MW000 query="SELECT mean(\"value\") FROM \"BathTemperature\" WHERE time >= now() - 1h and time <= now() GROUP BY time(2s) fill(null)"
Jan 16 14:47:01 shs2 influxd[1158]: ts=2022-01-16T13:47:01.759612Z lvl=info msg="Executing query" log_id=0Z3jR4MW000 service=query query="SELECT mean(value) FROM openhab.Forever.BathTemperature WHERE time >= now() - 1h AND time <= now() GROUP BY time(2s)"
Jan 16 14:47:07 shs2 influxd[1158]: ts=2022-01-16T13:47:07.063696Z lvl=info msg="executing new query" log_id=0Z3jR4MW000 query="SELECT mean(\"value\") FROM \"BathTemperature\" WHERE time >= now() - 1h and time <= now() GROUP BY time(2s) fill(null)"
Jan 16 14:47:07 shs2 influxd[1158]: ts=2022-01-16T13:47:07.063956Z lvl=info msg="Executing query" log_id=0Z3jR4MW000 service=query query="SELECT mean(value) FROM openhab.Forever.BathTemperature WHERE time >= now() - 1h AND time <= now() GROUP BY time(2s)"
l

LIMIT 100
I have way more than 100 measurements. Could that be the problem?

Edit2:
Starting to think this a Influx problem since:

omr@shs2:~$ curl --get http://localhost:8086/query?db=openhab_db --header "Authorization: Token c5heYDTRfynpj3UkQleV4s9N3b6LDRVdcTKMRoJyH1J0oLom3qZQivjOnwPsIcjjMqX7XX9td3x-rE674s-CBw=="   --data-urlencode "q=SELECT used_percent FROM openhab_db.Forever.BathTemperature WHERE host=host1"
{"results":[{"statement_id":0}]}
omr@shs2:~$

Asked on their forum as well:

1 Like

Hello. So as you have probably found, the documentation of setting up Grafana with Influx is often outdated and/or unclear because it references old versions of both products and the Flux vs InfluxQL thing is still not crystal clear in the various tutorials and examples online. My understanding is that when one makes the jump from InfluxDB 1.8 to 2.x, then one MUST use Flux, but apparently this thread indicates that InfluxQL can work.

I do not see any obvious problems with what you showed.

Can you see/start Influx Data Explorer at http://localhost:8086 ? It would look like this and you can easily build queries using the choices at the bottom. This makes Flux almost a non-issue because you can build the query using a GUI and then show the Flux query (that you just built) and copy/paste it into Grafana.

Sorry for the long overdue response!
Thank you for pointing me in the right direction.
After selecting the right Organization in Data Explorer, the .measurements column appeared :slight_smile:
I was able to find the Flux query after hitting the Query Builder button.

As for Grafana, v8.3.3 was not able to connect to the influxDb at all. Updating to 9.1.4 fixed that and now it is working with Flux queries. Selecting InfluxQl it is not able to connect, so all my old Dashboards are gone.

@olemr Thanks for the update. Re-creating your dashboards using Flux queries is not that bad. You can build the query using a http://influxdatabase:8086 query builder, then copy/paste it into Grafana.