Introduction
snmpkit is a high-performance SNMP toolkit for Python, powered by Rust.
Why snmpkit?
- Fast — Rust-powered encoding is up to 127x faster than pure Python
- Async-first — Built on Python’s asyncio with uvloop
- Type-safe — Full type hints throughout
- Simple API — Clean, intuitive interface
- Complete — Both Agent and Manager APIs
What can you build?
SNMP Manager
Query and monitor SNMP devices:
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.1.2"):
print(f"{oid} = {value}")
asyncio.run(main())Use cases:
- Network monitoring and polling
- Device discovery and inventory
- Configuration management
- Trap receiving and alerting
SNMP Agent
Build AgentX subagents that connect to Net-SNMP’s snmpd:
import snmpkit
from snmpkit.agent import Agent, Updater
class MyUpdater(Updater):
async def update(self):
self.set_OCTETSTRING("1.0", "Hello, SNMP!")
self.set_INTEGER("2.0", 42)
async def main():
agent = Agent()
agent.register("1.3.6.1.4.1.12345", MyUpdater())
await agent.start()
snmpkit.run(main())Use cases:
- Expose custom application metrics via SNMP
- Build network monitoring agents
- Create device management interfaces
- Implement enterprise MIBs
Performance
snmpkit’s Rust core delivers significant performance improvements:
| Component | Operation | Speedup |
|---|---|---|
| Manager | BER Encode | 127x faster than pysnmp |
| Manager | GET Request | 8.5x faster than pysnmp |
| Manager | WALK | 14x faster than pysnmp |
| Agent | PDU Encode | 11.5x faster than pyagentx3 |
See Manager Performance and Agent Performance for detailed benchmarks.
Next Steps
- Getting Started — Install snmpkit
- Manager Guide — Query SNMP devices
- Agent Guide — Build SNMP agents
Last updated on