Snmp input regex conversion help

hello,
i am new to telegraf and specially with regex. i pull some temperature data which has whitespaces in front. so i cannot read the data in grafana / Influx correctly as it seems.
for me it seems that i have to Strip the whitespaces to store the data correctly.
but i do not really know…
any help appreciated.

conf file:
[[inputs.snmp]]
agents = [ “192.168.1.102:161” ]
community = “public”
name = “snmp”
version = 1
retries = 3
timeout = “10s”

[[inputs.snmp.field]]
  name = "Temp Intern iTi"
  oid = ".1.3.6.1.4.1.36791.2.1.6"

[[processors.regex]]
namepass = [“snmp”]
[[processors.regex.fields]]
key = “Temp Intern iTi”
pattern = “^\s*(\d{1,3}\.\d)" replacement = "{1}”
result_key = “temp”

output of telegraf test:

snmp,agent_host=192.168.1.102,host=xxx.xxx.xxx.xxx Sensor\ S0_1_V=0,Sensor\ S0_1_Z=13674.359,Sensor\ S0_2_V=0,Sensor\ S0_2_Z=174.189,Temp\ Intern\ iTi=" 29.8" 1563910360000000000

The telegraf --test command doesn’t run the processors, it’s something I’ve 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

I believe your regular expression will match, but you might also consider using the strings + converter plugin and switching the temperature to a float, this way you could do comparison operations:

[[processors.strings]]
  order = 1
  namepass = ["snmp"]
  [[processors.strings.trim]]
    field = "Temp Intern iTi"

[[processors.converter]]
  order = 2
  namepass = ["snmp"]
  [processors.converter.fields]
    float = ["Temp Intern iTi"]

hi daniel,
ist working!
thanks good master!! :smile: