SnmpKit.SnmpMgr.Walk (snmpkit v2.0.1)
SNMP walk operations using iterative GETNEXT requests.
This module provides efficient walking of SNMP trees and tables using the GETNEXT operation repeatedly until the end of the subtree.
Return shape
Like every other SnmpMgr operation since 1.0, walks return enriched varbind maps, one per object:
%{
oid: "1.3.6.1.2.1.1.1.0", # dotted string
oid_list: [1, 3, 6, 1, 2, 1, 1, 1, 0],
type: :octet_string,
value: "System description",
name: "sysDescr.0", # when include_names: true (default)
formatted: "System description" # when include_formatted: true (default)
}:name and :formatted can be switched off per call with
include_names: false / include_formatted: false, or globally through
SnmpKit.SnmpMgr.Config. The pre-1.0 {oid, type, value} tuples are no
longer returned by any path; pattern-match on the map keys instead.
Summary
Functions
Performs a walk starting from the given root OID.
Walks a specific table column.
Walks an SNMP table starting from the table OID.
Types
@type oid() :: binary() | [non_neg_integer()]
@type varbind() :: SnmpKit.SnmpMgr.Format.enriched_varbind()
Functions
Performs a walk starting from the given root OID.
Automatically chooses between GETNEXT (SNMPv1) and GETBULK (SNMPv2c) based on the version specified in options.
Parameters
target- The target deviceroot_oid- Starting OID for the walkopts- Options including :version, :max_repetitions, :timeout, :community
Examples
{:ok, results} = SnmpKit.SnmpMgr.Walk.walk("192.168.1.1", [1, 3, 6, 1, 2, 1, 1])
# [
# %{oid: "1.3.6.1.2.1.1.1.0", oid_list: [1, 3, 6, 1, 2, 1, 1, 1, 0], name: "sysDescr.0",
# type: :octet_string, value: "System description", formatted: "System description"},
# %{oid: "1.3.6.1.2.1.1.2.0", oid_list: [1, 3, 6, 1, 2, 1, 1, 2, 0], name: "sysObjectID.0",
# type: :object_identifier, value: [1, 3, 6, 1, 4, 1, 9, 1, 1], formatted: "1.3.6.1.4.1.9.1.1"},
# %{oid: "1.3.6.1.2.1.1.3.0", oid_list: [1, 3, 6, 1, 2, 1, 1, 3, 0], name: "sysUpTime.0",
# type: :timeticks, value: 12345, formatted: "2 minutes 3 seconds"}
# ]
# Bare maps without names/formatting:
{:ok, [%{oid: _, type: _, value: _} | _]} =
SnmpKit.SnmpMgr.Walk.walk("192.168.1.1", "system", include_names: false, include_formatted: false)
Walks a specific table column.
Returns enriched varbind maps (see the module documentation).
Parameters
target- The target devicecolumn_oid- The full column OID (table + entry + column)opts- Options
Walks an SNMP table starting from the table OID.
Automatically chooses between GETNEXT and GETBULK based on version. GETBULK provides significantly better performance for large tables.
Parameters
target- The target devicetable_oid- The table OID to walkopts- Options including :version, :max_repetitions, :timeout, :community