Hello, and thank you in advance for any help you may provide.
I have influxdb and telegraf running and collecting data.
I have a question about using regex to change the results of an snmp pull from an IP camera.
The results I get for some of the fields contain the word PERCENT with the data. So, instead of getting just a numerical value of “10”, I get “10 PERCENT.”
I have been using [[processors.regex]] to try and get rid of the “PERCENT” but I seem to be missing something.
Here is my current config:
[[inputs.snmp]]
agents = [ "ipaddress" ]
version = 2
community = "pass"
interval = "60s"
timeout = "10s"
retries = 3
[[inputs.snmp.field]]
name="cpuPercent"
oid = "HIK-DEVICE-MIB::cpuPercent.0"
[[processors.regex]]
namepass = "cpuPercent"
order = 1
[[processors.regex.fields]]
pattern = "[^ ]+ PERCENT"
replacement = "${1}"
When I look in the influxdb I am still getting a value of “10 PERCENT”
name: snmp
time agent_host cpuPercent
---- ---------- ----------
1600392300000000000 IP-ADDRESS 10 PERCENT
I believe the regex itself is correct (I certainly could be wrong), but I believe I am missing something with the telegraf syntax.
Any advice? Thanks again!