SnmpKit (snmpkit v1.3.23)
Unified API for SnmpKit - A comprehensive SNMP toolkit for Elixir.
This module provides a clean, organized interface to all SnmpKit functionality through context-based sub-modules:
SnmpKit.SNMP- SNMP operations (get, walk, bulk, etc.)SnmpKit.MIB- MIB compilation, loading, and resolutionSnmpKit.Sim- SNMP device simulation and testing
Timeout Behavior
SnmpKit uses two types of timeouts:
PDU Timeout (:timeout parameter)
- Controls how long to wait for each individual SNMP PDU response
- Default: 10 seconds for GET/GETBULK, 30 seconds for walks
- Applied per SNMP packet, not per operation
- Retries, when configured, are additional attempts for the same PDU
Walk Timeout (:walk_timeout parameter)
- Prevents operations from hanging indefinitely
- Applies to the whole walk, while
:timeoutstill applies to each PDU - Defaults to a bounded long-running timeout for large table walks
Walk Operations
Walk operations may send many GETBULK PDUs to retrieve all data:
- Each PDU has its own timeout (PDU timeout)
- A single-target regular walk reuses one private UDP socket for the walk
- Large tables may need 50-200+ PDUs
- Total time is bounded by
:walk_timeout
Quick Examples
# SNMP Operations
{:ok, value} = SnmpKit.SNMP.get("192.168.1.1", "sysDescr.0")
{:ok, results} = SnmpKit.SNMP.walk("192.168.1.1", "system")
# With custom PDU timeout
{:ok, value} = SnmpKit.SNMP.get("192.168.1.1", "sysDescr.0", timeout: 15_000)
{:ok, results} = SnmpKit.SNMP.walk("192.168.1.1", "ifTable", timeout: 30_000)
# MIB Operations
{:ok, oid} = SnmpKit.MIB.resolve("sysDescr.0")
{:ok, compiled} = SnmpKit.MIB.compile("MY-MIB.mib")
# Simulation
{:ok, device} = SnmpKit.Sim.start_device(profile, port: 1161)For backward compatibility, many common operations are also available directly on the main SnmpKit module.