Telegraf: Cannot Get strings.replace To Work

OS: Ubuntu 14.04 amd64

telegraf --version
Telegraf 1.12.3 (git: HEAD 16784bca)

I am collecting IPMI data using the ipmi_sensor input module. I have a need to replace the value of a certain tag by key name. Some servers report temperature by setting “name” to “ssb_temp” while others use “system_temp” - I am attempting to normalize all input by replacing all instances of “name=ssb_temp” tag with “name=system_temp” tag.

Here are the relevant config blocks:

#####################
# PROCESSOR PLUGINS #
#####################

[[processors.strings]]
  [[processors.strings.replace]]
    tag = "name"
    old = "ssb_temp"
    new = "system_temp"


###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

[[inputs.ipmi_sensor]]
   name_override = "node_sensors"
   servers = ["<redacted>:<redacted>@lan(10.0.0.213)", "<redacted>:<redacted>@lan(10.0.0.214)"]

   [inputs.ipmi_sensor.tagpass]
     name = [ "ps1_status", "ps2_status", "ssb_temp", "system_temp" ]

   ## Timeout for the ipmitool command to complete
   timeout = "10s"

   ## Schema Version: (Optional, defaults to version 1)
   metric_version = 2

Collecting the sensor data works fine. However, no matter what I try (strings.replace or regex.tags), I cannot get “ssb_temp” to convert to “system_temp”. Here is example of output:

/usr/bin/telegraf -config /etc/telegraf/telegraf.conf --input-filter ipmi_sensor --test
2019-10-17T20:50:45Z I! Starting Telegraf 1.12.3
node_sensors,cloud=irvine-ops-01,name=system_temp,server=10.0.0.214,unit=degrees_c status=1i,value=33 1571345446000000000
node_sensors,cloud=irvine-ops-01,name=ps1_status,server=10.0.0.214 status=1i,value=1 1571345446000000000
node_sensors,cloud=irvine-ops-01,name=ssb_temp,server=10.0.0.213,unit=degrees_c status=1i,value=38 1571345447000000000
node_sensors,cloud=irvine-ops-01,name=ps1_status,server=10.0.0.213 status=1i,value=0 1571345447000000000
node_sensors,cloud=irvine-ops-01,name=ps2_status,server=10.0.0.213 status=1i,value=0 1571345447000000000

I feel like I must be misunderstanding how this replace filter is supposed to work. I only have this one processor defined. Setting “order” doesn’t make any difference (as expected as there is only one processor defined).

I don’t see anything useful in “-debug” output. I’m hoping someone can either point me in the right direction, or advise on if there is some sort of verbose mode where I can evaluate each processor execution and the results.

Thanks in advance.

Jeremy

One gotcha we haven’t resolved yet is that Telegraf doesn’t apply the processors when ran with --test, maybe this is what you are running into. I usually configure a file output temporarily to take a look at the processed output.

1 Like

Wow @daniel - that worked. It shows up in the regular output (not test mode). I thought I was crazy :slight_smile:

Will keep this in mind for future changes. Thanks for the advice.

Jeremy