Search documentation of snmpkit

# SnmpKit.SnmpMgr.MultiV2 (snmpkit v1.2.0)

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

execute_mixed(operations, opts \\ [])

Executes mixed SNMP operations against multiple targets concurrently.

get_bulk_multi(targets_and_oids, opts \\ [])

Performs GETBULK operations against multiple targets concurrently.

get_multi(targets_and_oids, opts \\ [])

Performs GET operations against multiple targets concurrently.

walk_multi(targets_and_oids, opts \\ [])

Performs walk operations against multiple targets concurrently.

walk_table_multi(targets_and_tables, opts \\ [])

Performs table walk operations against multiple targets concurrently.

# Functions

# execute_mixed(operations, opts \\ [])

Executes mixed SNMP operations against multiple targets concurrently.

## Parameters

- `operations` - List of {operation, target, oid_or_args, opts} tuples
- `opts` - 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"}, ...]}
    ]

# get_bulk_multi(targets_and_oids, opts \\ [])

Performs GETBULK operations against multiple targets concurrently.

## Parameters

- `targets_and_oids` - List of {target, oid} or {target, oid, opts} tuples
- `opts` - Global options applied to all requests
  - `:max_repetitions` - Maximum repetitions for GetBulk (default: 30)

## 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"}, ...]}
    ]

# get_multi(targets_and_oids, opts \\ [])

Performs GET operations against multiple targets concurrently.

## Parameters

- `targets_and_oids` - List of {target, oid} or {target, oid, opts} tuples
- `opts` - 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}
    ]

# walk_multi(targets_and_oids, opts \\ [])

Performs walk operations against multiple targets concurrently.

## Parameters

- `targets_and_oids` - List of {target, root_oid} or {target, root_oid, opts} tuples
- `opts` - 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}, ...]}
    ]

# walk_table_multi(targets_and_tables, opts \\ [])

Performs table walk operations against multiple targets concurrently.

## Parameters

- `targets_and_tables` - List of {target, table_oid} or {target, table_oid, opts} tuples
- `opts` - 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"}, ...]}
    ]