SnmpKit (snmpkit v1.3.2)
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
Task Timeout (internal)
- Prevents operations from hanging indefinitely
- GET/GETBULK: PDU timeout + 1 second (safeguard)
- Walk operations: 20 minutes maximum (allows large table walks)
Walk Operations
Walk operations may send many GETBULK PDUs to retrieve all data:
- Each PDU has its own timeout (PDU timeout)
- Large tables may need 50-200+ PDUs
- Total time = N_pdus × PDU_timeout (up to 20 minute maximum)
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.