Rename Network Interface


Likely a dumb question, but I just can’t seem to find it :frowning_face:. I have a few machines, collecting data via Telegraf (which is working great, thanks!) … but, I am also using a Grafana dashboard to display the results. Both are working OK, with one exception - my graphs break because the various machines use different names for their network interfaces. So I’d like to have Telegraf use a name I define.

For example, I see in my telegraf database,

Yet on another machine, that interface is p1p1, and another, eth0. I’d like to name them all, for example, lan. I have tried [[processors.rename.replace]], but that doesn’t seem to do it. Any suggestions?


OK, I found the regex processor - seems to be what I need, but it’s not quite working (likely me!). Here is what I have as the regex config,

  namepass = ["net"]
    key = "interface"
    pattern = "enp0s10"
    replacement = "lan"

But when I run,
telegraf --config /etc/telegraf/telegraf.conf --input-filter net --test

I get,

2020-05-02T21:13:08Z I! Starting Telegraf 1.14.2
> net,host=cpqServer,interface=enp0s10 bytes_recv=48539164i,bytes_sent=79017764i,drop_in=41654i,drop_out=0i,err_in=0i,err_out=0i,packets_recv=420469i,packets_sent=308732i 1588453989000000000

Doesn’t seem to be applying regex as desired (to change interface=enp0s10 to interface=lan)?


Hello @arrmo,
It isn’t you! The telegraf --test command doesn’t run the processors, it’s something the team has been meaning to change but never get the time. I usually debug this by adding a file output writing to stdout and then run Telegraf for a bit with only the plugins of interest, this way I avoid writing unwanted data to my database:

telegraf --input-filter=snmp --output-filter=file

^taken from Snmp input regex conversion help

Issue 6290

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.