Code Monkey home page Code Monkey logo

wapsnmp's Introduction

WapSnmp : SNMP client for golang

This is an open-source SNMP client library for Go. This allows you to query SNMP servers for any variable, given it's OID (no MIB resolution). It is released under the Apache 2.0 licence.

This library has been written to be in Go style and that means it should be very resistent to all error conditions. It's entirely non-blocking/asynchronous and very, very fast. It's also surprisingly small and easy to understand. Excellent test coverage is provided.

It supports the following SNMP operations:

  • Get
  • GetMultiple
  • Set
  • SetMultiple
  • GetNext
  • GetBulk
  • GetTable (use getBulk to get an entire subtree)

All of these are implemented with timeout support, and correct error/retry handling.

It supports SNMPv2c or lower (not 3, due to it's complexity), and supports all methods provided as part of that standard. Get, GetMultiple (which are really the same request, but ...), GetNext and GetBulk.

It has been tested on juniper and cisco devices and has proven to remain stable over long periods of time.

Example usage of the library:

func DoGetTableTest(target string) {
      community := "public"
      version := SNMPv2c

      oid := MustParseOid(".1.3.6.1.4.1.2636.3.2.3.1.20")

      fmt.Printf("Contacting %v %v %v\n", target, community, version)
      wsnmp, err := NewWapSNMP(target, community, version, 2*time.Second, 5)
      defer wsnmp.Close()
      if err != nil {
              fmt.Printf("Error creating wsnmp => %v\n", wsnmp)
              return
      }

      table, err := wsnmp.GetTable(oid)
      if err != nil {
              fmt.Printf("Error getting table => %v\n", wsnmp)
              return
      }
      for k, v := range table {
              fmt.Printf("%v => %v\n", k, v)
      }
}

This library can also be used as a ASN1 BER parser.

The library has native support for a whole lot of SNMP types :

  • Boolean
  • Integer
  • OctetString (string)
  • Oids
  • Null
  • Counter32
  • Gauge32
  • TimeTicks
  • EndOfMibView

And this should be easy to expand.

wapsnmp's People

Contributors

cdevr avatar minusnine avatar railsmechanic avatar subito avatar zielu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.