I have a graph that monitors an alarm sensor with readings representing an event (i.e. a large event has triggered an alarm). The data for this is being reported every second.
I’d like to review this data over a longer period, say 90 days so that I can quickly see what events have occurred.
This obviously pulls in too much data to display so aggregation is necessary and I’m currently using this command:
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: true)
And it produces a graph like this:
When you ‘zoom’ in on the small peaks on the right the aggregation dilutes and the peaks match the same level as the larger peaks ones seen in the graph on the left.
Is there a better aggregation method that I can use so I can see these peaks with more definition? I’m worried that I might be missing events that are short in duration.
Or is there a better way to show these events i.e. no in graph form?
You need to be aware that
v.windowPeriod automatically changes as you change interval from lets say 7 day to 90 days. The longer period you choose in Grafana the larger
v.windowPeriod will be. Since you are using
mean function while aggregating data you get one data point for every
v.windowPeriod which represents average value of that period. Now, if sensor reported high value just few times in
v.windowPeriod while the rest of time reported 0 you will get small average value like on the right side of graph.
You can either manually define value of
every: to smaller interval (e.g.
every: 5m) or if sensor always report same high value you can use max function instead of mean.
Pictures of different interval for different time range
For 90 days interval and v.windowPeriod is 5m :
For 90 days interval and v.windowPeriod is 1h :
Thanks, I was aware of the time window change, but hadn’t thought about the max function. That worked perfectly, thank you.