Telegraf tail pulgin - how to specify metric type?

I’m using prometheus and would like to use telegraf for collecting custom metrics.
I tried tail input plugin, but could not figure out how to get use of metric types such as counters.
Whatever metrics I add to tail input, they appear to be as gauges in prometheus output, i.e. values do not aggregate.
For example:
I have a file ingested by tail input plugin:

mytest_counter value=1
mytest_counter value=1

The output is:

# HELP mytest_counter Telegraf collected metric
# TYPE mytest_counter untyped
mytest_counter{host="..."} 1

Desired output:

mytest_counter{host="..."} 2

How can I make specific metrics behave as counters, so that they aggregate (sum) their values?

There is an issue open to add sum support to the basicstats aggregator which would allow this, but currently I don’t believe there is a way to do this: Add "sum" to basicstats aggregator · Issue #3467 · influxdata/telegraf · GitHub

1 Like