Re: [go-nuts] Announcing GoSNMP: a native Golang SNMP Client

3,170 views
Skip to first unread message

techabc

unread,
Aug 13, 2012, 12:05:11 PM8/13/12
to golang-nuts
nice!
It's near to develop EMS/NMS use golang. Hope GUI toolkit come out.

2012/8/12 <alo...@gmail.com>:
> Hello,
>
> This is my first post to the go-nuts group. I've seen couple of requests for
> an SNMP client for Go before, so posting here as well for anyone interested.
>
> The code and example are available at: https://github.com/alouca/gosnmp
>
> It currently implements GetRequest almost fully, with SetRequest and Walk
> coming the next few days.
>
> Thanks,
> Andreas
>

John Beisley

unread,
Aug 26, 2012, 5:23:12 AM8/26/12
to alo...@gmail.com, golan...@googlegroups.com
Your library looks good, and is much better than my efforts to update
an older SNMP library to more data types.

One problem it suffers from, however, is that it cannot parse the full
range of SNMP packets (or at least not those supplied by my home
router). The trouble it's running into is that encoding/asn1 in the Go
standard library was written to support cryptographic needs, which
places restrictions on the BER encoding that is allowed to be parsed
(the DER unique encoding requirements). Specifically it disallows
superfluous leading zeros in length fields, I get this error in
particular:

Unable to decode packet: ASN.1 structure error: superfluous leading
zeros in length

Which can be traced back to http://golang.org/src/pkg/encoding/asn1/asn1.go#L402

I'm not sure what to do about this. It would be nice to be able to use
encoding/asn1 to parse non-DER compliant ASN1 data, but obviously to
do so would require an API change in encoding/asn1 in order to support
both the DER and non-DER compliance modes.

Sonia Hamilton

unread,
Dec 7, 2012, 6:50:14 AM12/7/12
to golan...@googlegroups.com, alo...@gmail.com
In the spirit of "announce early and announce often" :-) I'm pleased to announce soniah/gosnmp, a rewrite of alouca/gosnmp. Many thanks to Andreas for starting the GoSnmp project.

Features:
  • it works (mostly... see BER/DER)
  • re-implemented to use golang/asn1 (ie with DER not BER)
  • cleaner code, better doco and examples (well this is subjective...)
  • multiple decoders to make usage convenient eg decode to Interface{}, to string, to int64
  • ongoing development - I need GoSnmp for a large project I'm working on :-)

I'm aware of the difference between DER & BER - I used to DER to "get the project out the door" ie 95% accuracy is better than none at all, and I'll work on BER problems as they arise...

Comments/pull requests welcome.

--

Sonia Hamilton  http://www.snowfrog.net http://github.com/soniah/gosnmp

On Sunday, 26 August 2012 21:59:13 UTC+10, alo...@gmail.com wrote:
Hello all,

Apologies for the late reply, I was on holiday. Thanks for your interest in the library.

I'll post a fix regarding the network timeouts the next couple of days, as well as update the examples accordingly. Thanks for pointing that out.

I was thinking of abandoning encoding/asn1 completely, and moving to a hand-written parser to handle packing/unpacking the packet, but was going to this later as with asn1 it was faster to get something out. Anyway for parts of the process I do that anyway (with some code shared between gosnmp and asn1).

Is it possible get me a .pcap trace of the SNMP packet given back from your router so I can see the raw data?

Thanks,
Andreas

Sonia Hamilton

unread,
Feb 5, 2013, 12:46:06 AM2/5/13
to golan...@googlegroups.com, alo...@gmail.com
A note for future readers: I've annoted soniah/gosnmp as defunct - use soniah/gsnmpgo instead. Sonia.
Reply all
Reply to author
Forward
0 new messages