Telegraf measure increase by time

I’ve been playing around with telegraf and aggregators (in particular basicstats) and there is a thing that I’m trying to achieve:

I’m measuring increasing counters from a device (ifInOctets). What I want is counter increase/second (divergent, and in my context, eventually b/s).
Since this usually is a typical grafana type of analysis I don’t think this is a feature currently in telegraf.
So what I’ve done is to make a simple aggregator to do this calculation.
Is this a feature that might be interesting in telegraf or is it out of scope?


Hi @hwaastad,

Generally, people send the counter data to the database and convert it on the fly (using the non-negative derivative function in InfluxQL, for example), but I think it’s an interesting idea to add it to Telegraf. Why don’t you check out the file in the Telegraf repo and open up a PR to get some feedback from the team.

There is an open pull request for a difference aggregator #4435, which would be quite similar, but it hasn’t been reviewed yet.

1 Like

@noahcrowley and @daniel,
thx for answering. The diff would probably be an alternative. I’ll second that one.
Any hope for merging in 1.11 as noted? (I see some refactoring is needed in PR)

btw, for my own limited knowledge of telegraf/go, I see that Reset is triggered on every push.
What would be the penalty for not resetting cache on push and rather treat the input as a gliding window? (hence maintaining state). Not discussing basicstats here since I guess it needs reset.