InfluxDB: Aggregate multiple variables across multiple panels

Hi everyone,
I’m quite new with Grafana but I have to use it on daily basis at work to analyze data from our machines but I would like to improve some dashboard I made.
Most of the time i’m dealing with multiple sensors sample at 20kHz so it’s quickly become impossible to display them. I end up editing my visualization “Graph” or “Time series” panel with query inspector (Newby here) and aggregating them with “mean” and group them with a “time($interval)”.
I’m usually working with multiple panels at a time so I’m looking to aggregate(mean) all the panels at the same time with one toggle button and also changing the interval for all of them from a box.
Anyone have an idea how to do that?
Thanks!


Welcome @dunanbarthspam to the Grafana forum.

You mentioned that you have multiple sensors, but I did not see anything selected in the 3 template variables that are shown at the top (Sensors1, Sensors2, Sensors3). Do you use those when viewing the desired graph?
image

Could you just rewrite the query to aggregate(mean) all the different sensors on all the panels and have them them display on one graph? If you click on the pencil, you can write the InfluxQL query with more flexibility than using the provided query builder.

You mean like using the Time Picker?
image

Thanks @grant2 for your reply!

Sensors1, Sensors2 and Sensors3 are the name of my 3 panels I use and in each panel I can select multiple variables, usually 4-5 per panel but sometimes even more. The graph I’m viewing are directly those variables.
I need to switch between aggregate or not as my data set start to be huge as to troubleshoot I something need to analyze months of data to identify event and then zoom on the event and de-aggregate them to see more detail.
Not the time picker, but while using the “mean()” function I have to group by using “time($_interval)”. I modify this interval in order to really reduce the number of points.
For example if I look at data over 6 months, I will maybe replace “$_interval” with 1h or 2h, but if it’s for a shorter period of analyze I could just do 10s or 30s.

Hi @dunanbarthspam

So I’m afraid that I cannot really offer much help since you are using InfluxQL. Have you considered using Flux or SQL? It sounds like you need a customized aggregation method that considers both the number of sensors and the time window selected. This thread (which uses Flux) might be helpful. SQL is currently only for use with InfluxDB 3 (Cloud) and I am not sure how to do custom aggregations with SQL, but it should be possible.

1 Like