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?
@marina_pollehn
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
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!!!
Hi @krzysztof_hoja
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.
Thx for correction. “ctrl-c” + “ctrl-v” 😉
Kris