23 Apr 2024 03:02 PM
Hi,
I have a panel with the below timeseries command and it is working. However they would like to be able to change from avg to max, or other ones for that matter and without the need to change the DQL everytime in the panel.
I am doing a similar thing with dropdown values on the dashboard for the threshold of the disk usage. Doing the same for the avg to change it to max is not working.
Possible options are: min, max, avg
timeseries diskusage = avg(dt.host.disk.used.percent), by:{dt.entity.host,dt.entity.disk}, interval:1d
Any suggestions?
Solved! Go to Solution.
23 Apr 2024 09:41 PM
Variable value is a quoted string, so it is not possible to use it as a command or function in the query, but you can check such query:
timeseries {
avg_diskusage = avg(dt.host.disk.used.percent),
min_diskusage = avg(dt.host.disk.used.percent),
max_diskusage = avg(dt.host.disk.used.percent) },
by:{dt.entity.host,dt.entity.disk}, interval:1d
| fields diskusage=coalesce(
if($function=="max", max_diskusage),
if($function=="min", min_diskusage),
avg_diskusage ), interval, timeframe, dt.entity.host, dt.entity.disk
together with this definition of variable:
Kris
24 Apr 2024 12:20 PM
Hero! Works for me 🙂 Made a small correction to the operators.
timeseries {
avg_diskusage = avg(dt.host.disk.used.percent),
min_diskusage = min(dt.host.disk.used.percent),
max_diskusage = max(dt.host.disk.used.percent) },
Thank you so much!!!!
24 Apr 2024 03:41 PM
Thx for correction. "ctrl-c" + "ctrl-v" 😉
Kris
24 Apr 2024 01:44 PM
This is an excellent work around and exactly what we needed. @marina_pollehn already adjusted the panel on our side and it is working as expected.
Thank you.