barnaclebill - It appears that I have a valid c...
It appears that I have a valid connection between InfluxDB and Grafana, and I can see SK data in InfluxDB, but when I try to create a dashboard I don't see any data. Any ideas?
19 Replies
I would try to extract the actual query that Grafana is running, eyeball it for sanity and if you are using Flux copypaste it to influxdb ui query editor and fiddle with it to figure out what is wrong and how it compares to the query influx ui is executing
It seems like it's not actually doing a query...when I hit "refresh" nothing changes. Shouldn't the database fields populate automatically when I select the data source?
You need to write a query and select which bucket and time range before seeing data
Like Teppo said, go to script editor and copy the raw query from the query builder
OK, but Script Editor is in InfluxDB's Data Explorer. Am I supposed to create queries in InfluxDB and copy them to Grafana?
Should I be using InfluxQL or Flux as the query language? With Flux, the connection works but I don't see any in Grafana. With InfluxQL, I get an error when I try to connect: InfluxDB returned error: error reading influxDB
Use Flux queries
Until you get the hang of it you might consider the influx query builder. Then once you are more familiar with the syntax you can just write raw flux queries
You will always need ‘from()’ and ‘range()’ for every query
Then use filter() to reduce the data to what you want to display
You can use ChatGPT to help you write queries. Just tell it what data you want and the type of visualization
This is an example of signalk paths to Influx using the plugin. You can see that the filter reduces the date using the specified path. Then I populate the points for a time series graph with the aggregateWindow function
The signalk-to-influxdb-v2-buffer plugin is configured to write the path every minute
So is there no way to populate the available paths? Do you mind showing me a query that just pulls everything from the bucket? (like SQL "select * from *")
Keep in mind that every query is intended to work with a visualization, so there isn't really a select all query.
Use influx's query builder. This will help you with determining the tags and measurments available
You can give https://github.com/tkurki/signalk-grafana a try. With the SK datasource it presents a popup of paths available in the db and you don't need to know any Flux or InfluxQL, you just pick the paths you want and avg/min/max
GitHub
GitHub - tkurki/signalk-grafana: Signal K Grafana Datasource and Tr...
Signal K Grafana Datasource and Trackmap. Contribute to tkurki/signalk-grafana development by creating an account on GitHub.
OK, thanks. I think I was confused because I saw an old blog that showed creating a query dynamically based on the bucket contents, but that must have been InfluxDB v1.
I'm a bit late in the game, but I just went through the process of configuring SK+Influx2+Grafana with InfluxQL queries, and it was less painful than I expected. InfluxQL because Flux is already deprecated. I intend to document the process properly, but basically:
- Connect to Influx web UI (host.local:8086) and create an admin user, org (signalk) and bucket (signalk). Save the operator API token. I'm lazy and ignorant and just used the operator API token in the following steps.
- Install the signalk-to-influxdb2 plugin and configure it with the token, org and bucket info.
Next, configure Grafana to use an InfluxQL data source. Here are my notes:
Login to Grafana: http://openplotter.local:3001/
Click on "Add your first data source"
Data source type: Influxdb
Name: influxdb
Query language: InfluxQL
HTTP URL: http://localhost:8086
Add a Custom HTTP Header:
Header: Authorization
Value: Token < token from above >
Database: signalk
HTTP Method: GET
Min time interval: 1s
Then click "Save & test"
After a short while, you should get a positive acknowledgment
Having done this, you can create a dashboard and for the most tasks, you don't have to write the queries by hand but can just use the built-in query builder.
add to signalk-to-influxdb2 readme?
I can do that, too. But I want to write a proper guide for HALPI as well.
Are you using the InfluxDB query builder, or is there one in Grafana?
No Grafana only accepts raw queries for InfluxDB 2
Influxdb2 supports flux and influxQL
And i think matti is referring to the influxdb1 grafana datasource
The data source was named just "Influxdb" in Grafana. You could select the query language. Flux would use buckets natively, but InfluxQL uses InfluxDB v1 semantics and uses databases. InfluxDB requires a DBRP mapping to convert between bucket and database semantics, but recent v2 InfluxDBs can create the mapping on the fly. (Woohoo.) So, I was referring to using InfluxDB v2 and InfluxQL and Grafana and query builders.