I had a similar problem with a measurement that am writing blade chassis PSU
power consumption values into. We have two different chassis types with varying
number of PSUs, and I wanted a Grafana graph with the aggregate power
consumption per chassis.
This sounds like a simple sum() query, but the problem is that we are feeding
data into the series at (slightly) irregular intervals. This results in spikes
and valleys when Grafana applies the GROUP BY time($interval), since some of
the points "bunch up" and are summed by the same interval window, whilst other
windows are devoid of points. Also if I zoom out in Grafana, it auto-adjusts
the $interval, and ends up summing multiple points when it shouldn't.
Essentially I need to run a mean() query first to level out the spikes, with a
FILL(previous) to fill in any gaps. Then I need to sum these points with a
GROUP BY time() that matches mean() query.
It would be so nice to do this as a single step, but I had to resort to two
chained CQs:
CREATE CONTINUOUS QUERY chassis_power_fill_gaps ON perfdb BEGIN SELECT
mean("ac_power") AS ac_power INTO chassis_power_psu FROM chassis_psu GROUP BY
time(1m), host, psu FILL(previous) END
CREATE CONTINUOUS QUERY chassis_power_sum ON perfdb BEGIN SELECT
sum("ac_power") AS ac_power INTO chassis_power FROM chassis_power_psu GROUP BY
time(1m), host END
With these two CQs in place, I can then construct the Grafana graph which will
SELECT mean(ac_power) with an automatic GROUP BY time($interval). Zooming out
no longer produces higher than expected results, since the mean() takes care of
that.
On Tuesday, March 29, 2016 at 12:33:12 AM UTC+2, Todd White wrote:
> Ah, that's what I was afraid of.
>
>
> I'm trying to use the auto $period stuff in Grafana to dynamically choose a
> granularity (time period) for charts and it seems to choose from a lot of
> periods (1s, 5s, 10s, 30s, 1m, 5m, 10m, 30m, 1h, ... 1y).
>
>
> I guess I'll have build CQs for each of my measurements to aggregate at the
> period levels that I will choose to support (i.e. 5m, 1h, 1d) and disable the
> Grafana auto-period functionality. I was going to do that at some point so
> that I can lower the retention for my 5 minute data and have longer
> retentions for the aggregated data.
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/676b9b10-76e2-4d6c-9741-f09815417b06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.