Recommended package for SNMP

228 views
Skip to first unread message

Rajanikanth Jammalamadaka

unread,
Dec 10, 2015, 1:26:07 PM12/10/15
to golang-nuts
Hi

Is there a recommended package for SNMP?

I see a bunch of them on godoc.org but want to know if there is a recommended one?

Thanks,
Rajanikanth

Eric Johnson

unread,
Dec 10, 2015, 5:27:41 PM12/10/15
to golang-nuts
In case you don't get an answer to your direct question, here's an indirect answer. About two years ago, I ran into the same problem when looking at LDAP - there did not appear to be an obvious answer. One implementation was a wrapper around the C-API of openldap. The other was a Go-native re-write. And then there was a third that was a fork of something else.

What I did: I wrote a few interfaces defining what I needed out of an LDAP API. I wrote a wrapper around the three different implementations. In some cases the interface was trivial, because I modified my interface to match the LDAP implementations that looked most likely to succeed. Which meant that I didn't actually have to do anything except define and use the interfaces! Then, I ran my test cases with each implementation I wanted to try out.

If nothing else, you could try a similar pattern with SNMP. Due to the way that Go's interfaces work, this is a remarkably easy undertaking.

Bonus: when I was done, my main application didn't directly depend on an SNMP package. It just depended on something available that conformed to the necessary interfaces. This meant that I didn't have to pay the penalty of recompiling the LDAP implementation each time I built my app, because it was already built as part of my wrapper package. And further, when I ran into an LDAP server configuration limitation in my deployment (max 5000 responses to a query), I could hide the work-around to that limitation in my wrapper - again, no changes for my main application.

Eric.

Rajanikanth Jammalamadaka

unread,
Dec 10, 2015, 10:32:41 PM12/10/15
to golang-nuts
Thanks Eric.

Seems like this one: https://github.com/soniah/gosnmp will work for me.

Will keep your technique as a backup if that fails.

Thanks,
Rajanikanth

JM

unread,
Feb 14, 2017, 12:47:00 PM2/14/17
to golang-nuts
how did this work out for you?  I'm looking at doing some stuff with snmp v3.  

Rajanikanth Jammalamadaka

unread,
Feb 14, 2017, 8:08:20 PM2/14/17
to golang-nuts
It worked for me fine. I did not use the trap support (which was recently added).
Reply all
Reply to author
Forward
0 new messages