SnmpKit.SnmpSim.WalkParser (snmpkit v0.6.4)
Parse both named MIB and numeric OID walk file formats. Handle different snmpwalk output variations automatically.
Summary
Functions
Parse a walk file and return a map of OID -> value mappings.
Parse a single line from a walk file.
Functions
Parse a walk file and return a map of OID -> value mappings.
Supports both named MIB format and numeric OID format:
- Named: "IF-MIB::ifInOctets.2 = Counter32: 1234567890"
- Numeric: ".1.3.6.1.2.1.2.2.1.10.2 = Counter32: 1234567890"
Examples
{:ok, oid_map} = SnmpKit.SnmpSim.WalkParser.parse_walk_file("priv/walks/cable_modem.walk")
Parse a single line from a walk file.
Examples
# Named MIB format
result = SnmpKit.SnmpSim.WalkParser.parse_walk_line("IF-MIB::ifInOctets.2 = Counter32: 1234567890")
# => {"1.3.6.1.2.1.2.2.1.10.2", %{type: "Counter32", value: 1234567890, mib_name: "IF-MIB::ifInOctets.2"}}
# Numeric OID format
result = SnmpKit.SnmpSim.WalkParser.parse_walk_line(".1.3.6.1.2.1.2.2.1.10.2 = Counter32: 1234567890")
# => {"1.3.6.1.2.1.2.2.1.10.2", %{type: "Counter32", value: 1234567890}}