Is it possible for telegraf,
rename a field with a string value that the same script got from the agent?
example:
name |data
data1 | 33
data2 | 22
and also :
dataA | temperature
dataB | temperature_ext
telegraf could send to influx
temperature |33
temperature_ext|22
# Input plugin to gather data
[[inputs.file]]
files = ["/path/to/input/file.json"] # Replace with your data source
data_format = "json"
# Rename fields based on mapping
[[processors.rename]]
[[processors.rename.replace]]
field = "data1"
dest = "temperature"
[[processors.rename.replace]]
field = "data2"
dest = "temperature_ext"
# Output plugin to send data to InfluxDB
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "your-token"
organization = "your-org"
bucket = "your-bucket"
Thank you for replies,
I tried to check telegraf/docs/CONFIGURATION.md at master · influxdata/telegraf · GitHub
override / rename
in my case:
[[inputs.snmp.field]]
name = “interface_name_2”
oid = “.1.3.6.1.2” #( <— just an example ! ) #now in “interface_name_2” I got “WAN_b” (it is a string)
[[inputs.snmp.field]]
name = “counter_value_2”
oid = “.1.3.6.1” #( <— just an example ! ) #here in counter_value_2 I will have a numeric value : 120022202 (bytes)
I cannot write:
[[inputs.snmp.field]]
name = “${interface_name_2}” #I would naming the field with the value got to the beginning “WAN_b”
oid = “.1.3.6.1”
I can do it statically or rename later…
maybe is not possible just using telegraf itself.