Skip to content

Latest commit

 

History

History
executable file
·
41 lines (33 loc) · 866 Bytes

README.md

File metadata and controls

executable file
·
41 lines (33 loc) · 866 Bytes

SMI Parser for SNMP MIBs

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/elastiflow/smiparser/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())