My first time posting here and I am also new to Telegraf, so please go easy on me!
My goal is that I would like to use Telegraf to receive SNMP traps, but the requirement is that I do not want the OIDs to be translated. Instead of:
name=enterprises.9.9.41.2.0.1
I would like to have name=.1.3.6.1.4.1.9.9.41.2.0.1
So, I simply tried to remove all MIB files on the system from /usr/share/snmp/mibs directory, but then I have the error message in the Topic in the journalctl.
Perhaps there is an easier way to disable OID translation?
I have seen this post:
which seems to be the same issue, apparently this should have been solved last year, but I still experience this today.
Telegraf version is 1.27.3
@Hipska sorry, I don’t quite get it, what do you mean with: “…just use the OID tag on the trap…”?
Like I mentioned in my question, removing all MIBs from the system will still do some rudimentary translation, specifically .1.3.6.1.4.1 will still be translated to enterprises. I’m not quite sure why.
I managed to rig the plugins/snmp_trap/snmp_trap.go to have a no-op translator and use that by default. This seems to work.
I think the right way to do this could be to allow the snmp_translator in telegraf.conf to have the value none, which then does no translation. If I can find some time, I’ll open an issue, but I might be the only one who needs this
If there is some other way to achieve this, please do let me know!
Yes the other way is just using the tag named oid from your resulting metric, instead of trying to use the tag named name (which is indeed tried to be translated). The oid is the raw oid value…
So, how do I go about avoiding the translation error? What do I have to add in my config?
I have the most basic config, no mibs added anywhere.
Telegraf config:
[[inputs.snmp_trap]]
service_address = "udp://:3333"
version = "2c"
telegraf logs:
Feb 21 21:10:55 ip-172-31-21-212 telegraf[3776071]: 2024-02-21T21:10:55Z E! [inputs.snmp_trap] Error resolving OID oid=.1.3.6.1.2.1.1.3.0, source=172.31.30.44: not found
If you don’t have mibs, it will always log an error, since the plugin will always try to translate. But in your case you don’t want it anyway, so you can simply ignore the message and use the oid tag in your metric.