mibtool

module
v0.0.0-...-ec9027f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2022 License: MIT

README

SNMP MIB Parser for Go

Build Status GoDoc Version

The mibtool module contains packages for parsing SNMP MIBs and querying the information contained in them.

The information that can currently be extracted from MIBs is limited to symbol information and OIDs, but the intention is to extend the code to make more information available.

Installation

go get -u github.com/hallidave/mibtool/smi

Examples

mib := smi.NewMIB("/usr/share/snmp/mibs/iana", "/usr/share/snmp/mibs/ietf")
mib.Debug = true
err := mib.LoadModules("IF-MIB")
if err != nil {
	log.Fatal(err)
}

// Walk all symbols in MIB
mib.VisitSymbols(func(sym *smi.Symbol, oid smi.OID) {
	fmt.Printf("%-40s %s\n", sym, oid)
})

// Look up OID for an OID string
oid, err := mib.OID("IF-MIB::ifOperStatus.4")
if err != nil {
    log.Fatal(err)
}
fmt.Println(oid.String())

Directories

Path Synopsis
cmd
mib
Package smi implements a parser for SNMP MIBs.
Package smi implements a parser for SNMP MIBs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL