Hi all -
I’m trying to extract, group and filter data sourced from a query, which makes use of a custom key:value dashboard variable.
Grafana v9.5.21
Datasource Influx-DB
My variable node_ids_state looks as follows:
dev1 : 4711,dev2 : 4712,...
The key represents a device-name, the value holds the id which is used as tag for Influx-DB time-series.
My actual query is looking like this:
SELECT first("str") FROM "autogen"."nodes_hist" WHERE ("nodeId" =~ /${node_ids_state:pipe}/) AND $timeFilter group by time(60m),nodeId ORDER BY time DESC LIMIT 10000
The grouping on time(60m) I added to make sure all entries have valid data. Some updates only come in 30m interval.
My goal is to extract the time series from that query and count for each date/time how many results are of certain value. Values I’m interested in are:
ok
, degraded
for example.
The query result looks like this (this is for two devices now):
What I now did was transforming the Data in the following way to get it in one table:
What I now want is counting for every row the number of ok
and degraded
values and show them on a time-series or bar chart. I tried with Filter Data by Value
followed by Add Field from Calculation
to first filter and then count but this did not lead anywhere.
Would be really thankful if someone could share his/her thoughts on this.
Thanks and regards,
Oliver