I’ve been trying for hours to try to figure out how to use flux in a grafana query.
Is this even possible using the grafana/influxdb from the addon store?|
I’ve been trying for hours to try to figure out how to use flux in a grafana query.
Is this even possible using the grafana/influxdb from the addon store?|
Yes it is.
Thanks. Was watching the latest garafana video conference and was very interesting.
Just having an issue with directory /lib/grafana/plugins/ directory not being found.
Got to see why I can’t install it from my ubuntu terminal.
Looks like I do not have grafana-cli.
Do I need to uninstall the addon and install it from the ubuntu terminal?
Closed down the addon grafana from supervisor and installed grafana server from the terminal and now in grafana through port 3000.
This looks more promising.
Grafana-cli now installed and working
Finally after hours of struggling I have now have grafana-server running and accessible by browser and ALSO influxdb 2.0!
ok this is getting complicated. I see influxd 2.0 works with buckets (another name for databases?)
Now do I feed the HA data into the new influxd or pull from 8086 into 9999?
I still see my data in influxdb old version .
version 2.0.0 is a different ball game and its gone over my head in this moment.
I have influx and influxd in the ~/bin folder.
influxd is running as a service (port 9999)
Really struggling here.
I have thttp://192.168.1.120:9999/orgs/05b79376ddb7b000/ up and running (influxdb 2.0)
How do I pull in the data from the Homeassitant database. telegraf plugin?
The current InfluxDB integration only supports InfluxDB version 1.xx, it does not currently support InfluxDB 2.xx. I actually just submitted a PR to add 2.xx support to the integration although its still waiting on review so it will probably take a bit to make it into the final product.
Until 2.xx support is added it’ll be difficult to get HA data into an InfluxDB 2.0 instance. If possible I would recommend rolling back to InfluxDB 1.8. They made V1.8 support both the 2.xx and the 1.xx API to serve as a bridge between them. So I believe you should be able to write to it using the HA integration as well as read from it in Grafana as a 2.0 instance using Flux queries.
Note that I haven’t tried this myself so YMMV, I’m just quoting what I read in their API docs having spent a good bit of time looking at them recently.
I configured the Hass.io Grafana addon with flux like so:
plugins:
- grafana-influxdb-flux-datasource
And the datastore in Grafana:
However I don’t really use this any more. Flux queries are real slow, like over 4x slower.
From the URL you’re using to talk to Influx it looks like you’re using the Influx add-on. But my influx add-on is running InfluxDB 1.7.10 and it doesn’t say i have an update available. And my understanding from their docs was InfluxDB only supported the 2.0 API starting in v.1.8.
Did you update your add-on to run InfluxDB v1.8 somehow? If so, how?
I have not changed the InfluxDB version, it’s whatever comes with the Hass.io add-on. I guess to get the version number I need to log into the Docker container.
I understood that the flux only works with influxdb 1.8 or 2.0. I could not get it as an add on from the supervisor.
Couldn’t get the flux to work on grafana wiht influxdb addon. I had no plugin directory. Wasn’t able to install the cli either. So I unistalled the influx addon and installed 2.0. through the ubuntu terninal
It’s a different ball game altogether.
Still haven’t figured out how to get the data into it. Got all the cpu/computer data there but not the home assistant data yet.
Can you run a flux query from grafana with this connection? Should only work with influx 1.8 or 2.0 and flux running
Could you point me in the right direction in regards to wirting to influxdb if I roll it back to 1.8?
Is it more intuitive?
I’ll work on trying out 1.8 in the next day or 2.
Thanks
I’m looking now and I think I was wrong. It said in the docs that 1.8 was to be forward compatible with the 2.0 API and client libraries which I took to mean “compatible with both”. But upon closer inspection I’m realizing that I’m not seeing anything that says 1.8 works with the 1.xx API/Client Libraries. So now I’m thinking the 1.xx API is only available for influxDB <=1.7 and 1.8+ only uses the 2.0 API.
That seems like a pretty strange choice on their part to make a minor version that’s got a completely different API if true. But I guess that’s their decision.
Assuming that’s true I’m not really sure how you’d get HA to automatically push data into an InfluxDB 1.8 or 2.0 instance. The current InfluxDB integration does not support the 2.0 API since its built off of this client library. Working with a 2.0 instance (and apparently a 1.8 instance) requires this client library
One option here is to create a custom component if your comfortable in Python. Or I think you could do it in AppDaemon although I’m not 100% sure, I know about AppDaemon but I don’t actually use it since I use Node RED. Node RED for reference does have an InfluxDB option but it appears it also uses the 1.xx client libraries so I believe you’d have the same issues.
There’s also other more raw options. For instance, you could certainly set up a script to export the DB and import it into Influx on a schedule. It won’t be live but you could get it close. Or do you use the MariaDB addon and have your Influx setup in such a way that its able to see it? If so there must be a plugin for influx to pull data from a SQL database.
Other then that I’m not sure. I wanted this capability too which is why I made the PR for it. Hopefully there aren’t any issues and it can be incorporated in an upcoming release.
[EDIT] I take it back, Node RED does have an InfluxDB 2.0 option, it’s here
hmm interesting thanks. I’ve just installed that into my node-red add-on and I’ll have a look tomorrow at the instructions.
Here is my Influx version. There obviously is some support for Flux. Maybe (hopefully) it’s faster in the newer versions.
I had version 1.6. and could not get flux to work on it. Looks like you had success with 1.7. (odd they say it only works from >=1.8)
Were there any other specific configs/tweaks to had to do?
Thanks