github.com/soniah/gsnmpgo (go): Package gsnmpgo is an snmp library for Go; it uses Go/CGo to wrap gsnmp.  gsnmpgo is pre 1.0, therefore API's may change, and tests are minimal.  Snmp walks aren't being done as "GETBULK" when using snmp v2c, rather repeated getnexts are being done ie like snmp v1. The gsnmp C library doesn't implement GETBULK directly, my intention is to write the C code to do it.  Threading: either gsnmp isn't totally thread safe, or I'm making errors with my C calls from Go (more likely). I'm getting aborts with this message:  My current workaround is to force Query() calls to be synchronous:  gsnmpgo requires the following libraries, as well as library header files:  Here is an example of installation on Ubuntu Precise 12.04.1:  Builds ok with these C libs (Ubuntu versions shown):  (most of this code is in examples/example.go)  http://tools.ietf.org/html/rfc4088 is used for specifying snmp uris; as well as doing an snmp get you can also do a snmp getnext or snmp walk:  The results are returned as an LLRB tree to provide "ordered map" functionality (ie finding items by "key", and iterating "in order"). Items in the tree are of type QueryResult:  See http://github.com/petar/GoLLRB for more documentation on using the LLRB tree.  SNMP types are represented by Go types that implement the Varbinder interface (eg "Octet String" is VBT_OctetString, "IP Address" is VBT_IPAddress). Use a type switch to make decisions based on the SNMP type:  The Varbinder interface has two convenience functions Integer() and String() that allow you to get all your results "as a string" or "as a number":  Some of the Stringers are smart, for example gsnmpgo.VBT_Timeticks will be formatted as days, hours, etc when returned as a string:  The tests use the Verax Snmp Simulator [1]; setup Verax before running "go test":  * download, install and run Verax with the default configuration  * in the gsnmpgo/testing directory, setup these symlinks (or equivalents for your system):  * remove randomising elements from Verax device files:  [1] http://www.veraxsystems.com/en/products/snmpsimulator  There are a number of helper functions. Many of these have tests that serve as example usage.  PartitionAllP()  If you have a many oids to retrieve for a single device, you could:  Instead, use PartitionAllP() to break up your large list of OIDs into partitions of n.  Sonia Hamilton, sonia@snowfrog.net, http://www.snowfrog.net.
Keywords: c|go|golang