Hello, so I have a table with snmp agents (monitoring my network devices) but I was wondering if we can generate an ID for each agent, so for example instead if having:
agent_host hostname
10.X.X.X cisco1
i want to the influx de generate ID for each device so it would be like this:
ID agent_host hostname
1 10.X.X.25 cisco1
2 10.X.X.30 cisco2
Yes, you could use for example a processors.enum plugin in Telegraf.
It would also work with a processors.starlark or processors.strings plugin.
Here is a config example how it should work with the processors.enum plugin, adapt it if necessary:
[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map. Globs accepted.
field = "hostname"
## Name of the tag to map. Globs accepted.
# tag = "hostname"
## Destination tag or field to be used for the mapped value.
## By default the source tag or field is used, overwriting the original value.
dest = "id"
## Default value to be used for all values not contained in the mapping
## table. When unset and no match is found, the original field will remain
## unmodified and the destination tag or field will not be created.
default = 0
## Table of mappings
[processors.enum.mapping.value_mappings]
cisco1 = 1
cisco2 = 2
cisco3 = 3
If this doesn’t work for you, please post your Telegraf config snippet in Markdown format here in the forum: