SnmpKit.SnmpMgr.MultiV2 (snmpkit v0.6.6)
High-performance concurrent multi-target SNMP operations.
This module provides efficient SNMP operations against multiple targets using direct UDP sending and centralized response correlation, eliminating GenServer bottlenecks while maintaining proper concurrency control.
Summary
Functions
Executes mixed SNMP operations against multiple targets concurrently.
Performs GETBULK operations against multiple targets concurrently.
Performs GET operations against multiple targets concurrently.
Performs walk operations against multiple targets concurrently.
Performs table walk operations against multiple targets concurrently.
Functions
Executes mixed SNMP operations against multiple targets concurrently.
Parameters
operations
- List of {operation, target, oid_or_args, opts} tuplesopts
- Global options
Examples
iex> operations = [
...> {:get, "device1", "sysDescr.0", []},
...> {:get_bulk, "switch1", "ifTable", [max_repetitions: 20]},
...> {:walk, "router1", "system", []}
...> ]
iex> SnmpKit.SnmpMgr.MultiV2.execute_mixed(operations)
[
{:ok, "Device 1 Description"},
{:ok, [{"1.3.6.1.2.1.2.2.1.2.1", "eth0"}, ...]},
{:ok, [{"1.3.6.1.2.1.1.1.0", "Router 1"}, ...]}
]
Performs GETBULK operations against multiple targets concurrently.
Parameters
targets_and_oids
- List of {target, oid} or {target, oid, opts} tuplesopts
- Global options applied to all requests:max_repetitions
- Maximum repetitions for GetBulk (default: 10)
Examples
iex> requests = [
...> {"switch1", "ifTable"},
...> {"switch2", "ifTable"}
...> ]
iex> SnmpKit.SnmpMgr.MultiV2.get_bulk_multi(requests, max_repetitions: 20)
[
{:ok, [{"1.3.6.1.2.1.2.2.1.2.1", "eth0"}, ...]},
{:ok, [{"1.3.6.1.2.1.2.2.1.2.1", "GigE0/1"}, ...]}
]
Performs GET operations against multiple targets concurrently.
Parameters
targets_and_oids
- List of {target, oid} or {target, oid, opts} tuplesopts
- Global options applied to all requests:timeout
- Request timeout in milliseconds (default: 10000):max_concurrent
- Maximum concurrent requests (default: 10):return_format
- Format of returned results (default::list
):list
- Returns list of results in same order as input:with_targets
- Returns list of {target, oid, result} tuples:map
- Returns map with {target, oid} keys and result values
Examples
iex> requests = [
...> {"device1", "sysDescr.0"},
...> {"device2", "sysUpTime.0"}
...> ]
iex> SnmpKit.SnmpMgr.MultiV2.get_multi(requests)
[
{:ok, "Device 1 Description"},
{:ok, 123456}
]
Performs walk operations against multiple targets concurrently.
Parameters
targets_and_oids
- List of {target, root_oid} or {target, root_oid, opts} tuplesopts
- Global options applied to all requests
Examples
iex> requests = [
...> {"device1", "system"},
...> {"device2", "interfaces"}
...> ]
iex> SnmpKit.SnmpMgr.MultiV2.walk_multi(requests)
[
{:ok, [{"1.3.6.1.2.1.1.1.0", "Device 1"}, ...]},
{:ok, [{"1.3.6.1.2.1.2.1.0", 24}, ...]}
]
Performs table walk operations against multiple targets concurrently.
Parameters
targets_and_tables
- List of {target, table_oid} or {target, table_oid, opts} tuplesopts
- Global options applied to all requests
Examples
iex> requests = [
...> {"switch1", "ifTable"},
...> {"switch2", "ifTable"}
...> ]
iex> SnmpKit.SnmpMgr.MultiV2.walk_table_multi(requests)
[
{:ok, [{"1.3.6.1.2.1.2.2.1.2.1", "eth0"}, ...]},
{:ok, [{"1.3.6.1.2.1.2.2.1.2.1", "GigE0/1"}, ...]}
]