Manager
Query SNMP devices with snmpkit’s high-performance async manager.
Quick Example
import asyncio
from snmpkit.manager import Manager
async def main():
async with Manager("192.168.1.1", community="public") as mgr:
descr = await mgr.get("1.3.6.1.2.1.1.1.0")
print(f"Device: {descr}")
async for oid, value in mgr.bulk_walk("1.3.6.1.2.1.2.2"):
print(f"{oid} = {value}")
asyncio.run(main())Why snmpkit Manager?
snmpkit (Rust)
pysnmp (Python)
BER Encode
snmpkit
0.58 μs
pysnmp
73.4 μs
126.6x faster
GET Request
snmpkit
0.12 ms
pysnmp
1.02 ms
8.5x faster
WALK (38 OIDs)
snmpkit
0.78 ms
pysnmp
10.9 ms
14.0x faster
Lower is better. BER: 10,000 iterations. GET/WALK: 100 iterations against localhost snmpd.
- Fast — Rust BER encoding, up to 127x faster than pysnmp
- Async-native — Built on asyncio for concurrent requests
- Simple API — Context manager, async iterators, type hints
- Full SNMPv3 — USM authentication (MD5 to SHA-512) and privacy (DES, AES)
Features
| Feature | v1 | v2c | v3 |
|---|---|---|---|
| GET / GET-MANY | ✓ | ✓ | ✓ |
| GET-NEXT | ✓ | ✓ | ✓ |
| GET-BULK | ✓ | ✓ | |
| SET | ✓ | ✓ | |
| WALK / BULK-WALK | ✓ | ✓ | ✓ |
| Send Trap | ✓ | ✓ | |
| Send Inform | ✓ | ✓ | |
| get_table | ✓ | ✓ | |
| poll_many | ✓ | ✓ | |
| TrapReceiver | ✓ |
Configuration
from snmpkit.manager import Manager
# SNMPv2c
mgr = Manager(
host="192.168.1.1",
port=161,
community="public",
version=2,
timeout=5.0,
retries=3,
)
# SNMPv3 with auth + privacy
mgr = Manager(
host="192.168.1.1",
version=3,
user="admin",
auth_protocol="SHA256",
auth_password="auth_pass",
priv_protocol="AES",
priv_password="priv_pass",
)Operations
GET
value = await mgr.get("1.3.6.1.2.1.1.1.0")GET Many
values = await mgr.get_many(
"1.3.6.1.2.1.1.1.0",
"1.3.6.1.2.1.1.3.0",
"1.3.6.1.2.1.1.5.0",
)WALK
async for oid, value in mgr.walk("1.3.6.1.2.1.2.2"):
print(f"{oid} = {value}")BULK WALK
async for oid, value in mgr.bulk_walk("1.3.6.1.2.1.2.2", bulk_size=25):
print(f"{oid} = {value}")SET
from snmpkit.core import Value
await mgr.set("1.3.6.1.2.1.1.5.0", Value.OctetString(b"new-hostname"))Table
table = await mgr.get_table("1.3.6.1.2.1.2.2.1", columns=[2, 8])
for index, cols in table.items():
print(f"{index}: {cols}")Traps
await mgr.send_trap("1.3.6.1.4.1.12345.0.1")
await mgr.send_inform("1.3.6.1.4.1.12345.0.1")Concurrent Polling
from snmpkit.manager import PollTarget, poll_many
targets = [PollTarget(host="10.0.0.1"), PollTarget(host="10.0.0.2")]
async for result in poll_many(targets, ["1.3.6.1.2.1.1.1.0"]):
print(f"{result.target}: {result.value}")Next Steps
- Quickstart — Query your first device
- Operations — Detailed API reference
- SNMPv3 — Authentication and encryption
- Traps — Send and receive notifications
- Tables — Structured table queries
Last updated on