trishul-snmp

Configuration Reference

All runtime configuration is explicit on V2cManager, V2cNotifier, V2cNotificationListener, V2cResponder, and load_bundle(). The CLI maps directly to these knobs; there is no hidden global config layer.

from trishul_snmp import V2cManager, load_bundle

bundle = load_bundle("./IF-MIB.json")
manager = V2cManager(
    host="10.0.0.10",
    community="public",
    timeout=2.0,
    retries=1,
    bundle=bundle,
)

V2cManager fields

Field Type Default Description
host str required Target hostname or IP address
community str required SNMPv2c community string
port int 161 Target UDP port
timeout float 2.0 Per-request timeout in seconds
retries int 1 Retry count after the first attempt
bundle MibBundle \| None None Optional bundle used for symbolic translation and enrichment
max_datagram_size int 65535 Maximum UDP datagram size for receive operations

Validation notes:


V2cNotifier fields

V2cNotifier uses the same core connection and bundle knobs as V2cManager, but defaults port to 162.

Field Type Default Description
host str required Target notification receiver hostname or IP address
community str required SNMPv2c community string
port int 162 Target UDP port
timeout float 2.0 Inform request timeout in seconds
retries int 1 Inform retry count after the first attempt
bundle MibBundle \| None None Optional bundle used for symbolic translation and enrichment
max_datagram_size int 65535 Maximum UDP datagram size for receive operations

Validation notes:


V2cNotificationListener fields

Field Type Default Description
host str 0.0.0.0 Listener bind hostname or IP address
port int 162 Listener UDP port
communities Sequence[str] \| None None Optional SNMPv2c community allowlist
bundle MibBundle \| None None Optional bundle used for inbound enrichment

Behavior notes:


V2cResponder fields

Field Type Default Description
host str 0.0.0.0 Responder bind hostname or IP address
port int 161 Responder UDP port
communities Sequence[str] \| None None Optional SNMPv2c community allowlist
source ResponderSource \| None None Optional custom read-only source
objects iterable empty Initial object seed for the default in-memory source
bundle MibBundle \| None None Optional bundle for symbolic object registration in the default in-memory source

Behavior notes:


Bundle loading

load_bundle(path) accepts the following inputs:

Input Example Notes
Single module JSON file ./IF-MIB.json Valid standalone input for narrow use cases
Directory of module JSON files ./mibs-json Can use optional sidecars for inventory and lookup acceleration

Optional directory sidecars:

File Required Purpose
manifest.json no Deterministic module inventory
oid_index.json no Faster reverse OID lookup

If a directory has no manifest.json, tsnmp scans *.json files and ignores known sidecar names as module candidates.


CLI mapping

The CLI is a direct wrapper over the same runtime configuration:

CLI option Runtime mapping
--host V2cManager(...), V2cNotifier(...), or V2cNotificationListener(...) depending on the command
--port V2cManager(...), V2cNotifier(...), or V2cNotificationListener(...) depending on the command
--community V2cManager(community=...), V2cNotifier(community=...), or listener allowlist entries
--timeout V2cManager(timeout=...) or V2cNotifier(timeout=...)
--retries V2cManager(retries=...) or V2cNotifier(retries=...)
--bundle load_bundle(path) plus optional runtime bundle attachment
--json Output rendering only; no runtime behavior change
--numeric Output rendering only; no runtime behavior change
--non-repeaters get_bulk(..., non_repeaters=...)
--max-repetitions get_bulk(...), walk(...), or bulkwalk(...)
--no-bulk walk(..., bulk=False)
--uptime send_trap(..., uptime=...) or send_inform(..., uptime=...)
--varbind Notification varbind parsing at the CLI edge before calling V2cNotifier
--count Listener receive loop exit condition only

CLI defaults differ slightly from the Python API:


Behavioral notes