Mathematic calculation in telegraf

Hello,

is there a possbility that telegraf can do a calculation on the input value? I have a csv file and i’m working with the “inputs.directory_monitor”. The config file is working and send the metrics to the InfluxDB cloud. But some of the values must be multiplied with 0.1 to meet the units from the graph.

I expect I can also calculate with Flux, but it would be a good way if there is some way to make that already before the metrics are send to the database.

Greetings

Ehninchr

Hello @Ehninchr,
Absolutely.
You can use:

→ an example of the execd processor plugin:

→ an example of the starlark processor plugin:

I’d probably use the starlark processor plugin for that but up to you.

@Anaisdg:

Thanks for your help… I started with Starlark and after some problems i managed to do the calculation. One main problem was for me, that in the blog “How to Use Starlark with Telegraf” there were several code examples with missing the last line (11) with ‘’’

may that can be corrected, because I used the examples without the line 11 and it was not working. I can imagin that others would do in same way

Hello @Ehninchr,
Thank you so much for that feedback. We’ll correct the blog.