I have a temperature sensor hooked onto a raspberri pi and use influxdb as a database from which ì pull data to display in Grafana.
My data is a given temperature value at a certain time, 2 second intervals.
I am trying to achieve the following:
for this year, I need to have a cumulative total of days:hours:minutes that the temperature value was above 26.5 degrees. I try to display it as just a box with the amount of time in this year that the temperature went over 26.5 degrees.
I am new to influxdb and grafana but have managed to set up a dashboard, but cant for the life of me seem to create this simple sum up.
If someone can point me to a handy guide or has already made something like this and can point me to the right queries I am extremely grateful.
are you using influxQL or the newer flux language? influx version?
@sjoerdmostert Welcome to the forum. I am 95% sure your query is possible in Flux, and the best place to get the help is https://community.influxdata.com/ (although a lot of Flux questions get answered here too, but this one is really one for Influx).
If I had to venture a guess, your query might involve State Duration. Also, I am almost sure that in order to get the cumulative total time when the temperature value was above 26.5 degrees, you will have to use seconds or minutes as the unit of measure. To count the days where the temperature was above 26.5 degrees implies you are evaluating the temperature to be > 26.5 degrees for the entire 1440 minutes of the 24-hour day.
Here is a potentially good jumping off point: TL;DR Tech Tips — How to Monitor States with InfluxDB | by Anais Dotis | Medium
Thank you so much for looking into this! This is very helpful.
I will direct myself to the InfluxDB forums and read through those articles.
@mattabrams I am using InfluxQL! I will check the version tonite once Im back from work.
I am not sure how far you have gone into the Influx forest, but about 3-4 years ago they made a pivot from InfluxQL (which is very SQL like) to Flux (which is not really like anything I have used). Much of the Q&A on forums (in the past, but even today) involves InfluxQL, but I presume that will eventually be discontinued. So just keep this in mind when you work on this problem. We started with InfluxQL and migrated to Flux at the end of 2021 and it’s been mostly smooth sailing. It’s not super easy to pick up, but I do not think it is that daunting either.
I have started to learn a bit about Influx, hopefully I am able to build the check I want soon. Thanks for your help in pointing me to the right resources, will ask my question at the Influx community if I cant figure it out!