Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As requested in: #5720 (comment)
I'm submitting a very early implementation of using gosmi to translate SNMP OIDs for the snmp_trap plugin.
Using snmptranslate does not work well. It's slow to call it, and it requires a mutex lock to deal with the cache, which pretty much destroys any parallelism.
We ingest about 30 traps per second. Because of the varying OID index values coming in, the snmptranslate cache didn't really work as expected for us. Telegraf was pinned at 100% CPU usage.
I'm not a professional Go programmer and I'm not so great at unit tests. I'm hoping someone can take it from here and finish it off. We're using this implementation daily and it appears to work well for us. (less than 1% CPU usage from Telegraf to process those 30 traps/second).
The biggest shortfall of what I've upload here is that it uses a hardcoded path of
/usr/share/snmp/mibs
for the MIBs, it should probably be something that is configured as a plugin option. Also, the folder recursion is not very good, it doesn't go multiple levels into the folder structure.There is also a
gosmi.Exit()
function that should be called to clean things up that I never implemented here.