This approach should work, and by using the GROUP BY * in the continuous
query, all series will be downsampled and can be combined at will later.

On Wed, Aug 10, 2016 at 8:10 PM, Aaron Knister <[email protected]>
wrote:

> On 7/27/16 7:47 PM, [email protected] wrote:
>
>> Hello!
>>
>> I’ve got a few counters for different iptables rules (collected with
>> collectd).
>>
>> Using Grafana, I can plot rates (bytes/s) for these byte counters like
>> that:
>>
>> SELECT non_negative_derivative(sum("value"), 1s)
>>   FROM "iptables_value" WHERE
>>     "type" = 'ipt_bytes' AND
>>     "type_instance" = "$host" AND
>>     "instance" = 'filter-INPUT' AND
>>     $timeFilter
>>   GROUP BY time($interval) fill(null)
>>
>> $host here is Grafana’s templating parameter. It can be one/many/all
>> hosts, but that’s irrelevant, host selection works.
>>
>> Above query indeed returns bytes/s — as long as Grafana’s time $interval
>> is ≤ 10s. (I’m measuring at 10s intervals in collectd).
>>
>> I’m using sum() because the user can choose not only one, but many hosts
>> in one query (Grafana will automagically change the WHERE part of the query
>> to contain appropriate ORs).
>>
>> As long as $interval ≤ 10s, buckets contain only *one* value from any
>> given host. E.g. with 20s buckets, there are *two* values of each host in
>> the bucket, and, in the result, reported rate is 2× higher that it really
>> was.
>>
>> Now, on the plots that plot only *one* host’s data, I do use mean()
>> instead of sum(), and that works. But I also need “total” plots…
>>
>> The query should be:
>>
>> SELECT non_negative_derivative(sum(series_mean("value")))
>>
>> … but that’s really not possible…
>>
>
> I hate to do a "me too!" but this is something I would *really* like to be
> able to do. A possible workaround may be to have a continuous query that
> translates the data in iptables_value into something like
> iptables_value_rates_10s to create bins of the average number of bytes per
> second in each 10s window. Something like this might work:
>
> CREATE continuous query iptables_rate_ipt_bytes_s_10s ON gpfs
> BEGIN
>         SELECT non_negative_derivative(last(value), 1s) as value
>         INTO iptables_rate_10s
>         FROM "iptables_value"
>         WHERE "type" = 'ipt_bytes'
>         GROUP by time(10s), * fill(null)
> END
>
> (not sure of the exact syntax). You could then re-write your queries to do
> something like this:
>
> SELECT sum("value")
>   FROM "iptables_rate_10s" WHERE
>     "type" = 'ipt_bytes' AND
>     "type_instance" = "$host" AND
>     "instance" = 'filter-INPUT' AND
>     $timeFilter
>   GROUP BY time($interval) fill(null)
>
> I'm not quite sure if this works but it's what I've been toying about
> doing for my use case and have tested parts of it. I think the general idea
> will work, though.
>
>
>> What to do? I cannot define a Continuous Query for every possible
>> combination (subset) of hosts that the user can use. That would be 2^n CQs
>> for n hosts… =)
>>
>>
> --
> Aaron Knister
> NASA Center for Climate Simulation (Code 606.2)
> Goddard Space Flight Center
> (301) 286-2776
>
> --
> 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/ms
> gid/influxdb/e7d2aa4a-c38c-604c-bef2-1152150a39ad%40nasa.gov.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sean Beckett
Director of Support and Professional Services
InfluxDB

-- 
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/CALGqCvM%2B8mOYQWwTaPwDAvpdGCTK%2B5dPTqChxPeesGq4X9mBCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to