I Built a Free, Self-Hosted SNMP Toolkit — Now With Real-Time WebSocket Push
Source: Dev.to
What Is Trishul SNMP?
A self‑hosted SNMP dev toolkit that combines five tools into one clean web UI.
| What | Instead of |
|---|---|
| SNMP Simulator (UDP agent) | snmpsim + CLI config |
| Walk & Parse → JSON | snmpwalk + manual OID lookup |
| Trap Sender + Receiver | snmptrap + snmptrapd |
| MIB Browser (tree view) | iReasoning MIB Browser ($500+) |
| MIB Manager (upload/validate) | Text editor + manual dependency hell |
Stack: Python 3.11, FastAPI, pysnmp, pysmi, Bootstrap 5, Docker.
# Install in one command
curl -fsSL https://raw.githubusercontent.com/tosumitdhaka/trishul-snmp/main/install-trishul-snmp.sh | bash
Then open http://localhost:8080. Default login: admin / admin123 — change it immediately in Settings.
What’s New in v1.2.4
⚡ Real‑Time WebSocket Push — Polling Is Dead
The biggest architectural change: the entire frontend is now event‑driven.
Before: Every page polled the backend on a setInterval — dashboard every 30 s, simulator every 5 s. Stale data was common. Switching pages caused spinners.
After: A single persistent WebSocket connection at /api/ws. The backend broadcasts state changes the moment they happen. Dashboard, Simulator status, and Trap Receiver all update instantly — no refresh needed.
Browser ←──── WS push ────── FastAPI /api/ws
│
broadcasts on:
- trap received
- simulator start/stop
- MIB uploaded
- stats change
The navbar shows a live green dot when the WebSocket is healthy. On reconnect, the backend sends a full_state message to re‑seed everything — so you never see stale data after a network hiccup.
Why this matters for devs: If you’re building a trap handler and sending test traps from the UI, you now see the counter increment on the dashboard in real time. No F5 needed.
📊 Live Activity Stats Dashboard
A new 8‑counter row on the dashboard shows everything happening in your session:
| Counter | Description |
|---|---|
| SNMP Requests | Total polls served by the simulator |
| OIDs Loaded | OIDs currently in memory across all loaded MIBs |
| Traps Received / Sent | Live trap counters |
| Walks Executed | How many SNMP walks you’ve run |
| OIDs Returned | Total OIDs returned across all walks |
| MIBs Uploaded / Times Reloaded | MIB management activity |
All counters update via WebSocket push. They’re also file‑backed — they survive container restarts so you don’t lose your session history.
⚙️ Settings — Three New Cards
App Behaviour
- Two toggles: auto‑start Simulator and auto‑start Trap Receiver on container boot.
- Configurable session timeout (60 s – 86 400 s).
- Settings persist to
app_settings.jsonand take effect on next restart.
Stats Management
- Export all counters as JSON (useful for logging test session results).
- Reset counters to zero for a clean baseline before a test run.
About
- Version, author, and description pulled live from the backend — always in sync with what’s actually deployed.
🐛 Notable Fixes
| Issue | Fix |
|---|---|
Timestamp bug – Trap Receiver showed 1970 for Last Received when the backend returned a Unix epoch 0. | Guarded the value and now display -- when epoch is zero. |
| Traps Sent undercount – Stats were only incremented in the frontend; API‑direct trap sends never updated the counter. | Backend now broadcasts stats after every successful trap send. |
Dashboard spinners on page switch – WS full_state fired before DashboardModule.init() registered its listener, leaving tiles stuck as spinners. | Always seed via REST on init, regardless of WS state. |
MIB Browser state conflict – Navigating to the Browser from Walk & Parse (with a pre‑filled OID) sometimes logged Could not find node because the previous session’s pending tree state conflicted. | Clear pendingSelectedOid and pendingExpandedNodes when a programmatic OID search is present. |
Who Is This For?
- NMS / backend developers – Need a real SNMP agent to poll without actual hardware, or need to fire specific trap OIDs to validate handler code.
- DevOps / integration engineers – Need to test SNMP monitoring integrations in CI/staging environments.
- Network engineers – Want to explore MIB structures interactively — search by OID, by name, or by description — and understand what traps a device can fire before it’s on the floor.
What It’s NOT For
- Production 24/7 monitoring → use Zabbix, LibreNMS, PRTG.
- Enterprise NMS → use SolarWinds, Cisco Prime.
- High‑availability trap collection at scale → use dedicated platforms.
Trishul is a developer and testing tool, not a production monitoring system.
Quick Architecture
Browser (8080)
│ HTTP + WebSocket
▼
Nginx (static files + reverse proxy)
│ REST + WS
▼
FastAPI Backend (8000)
├── MIB Service (parse, validate, search)
├── SNMP Simulator (UDP 1061)
├── Trap Manager (send + receive on UDP 1162)
├── Walker (SNMP walk client)
└── WebSocket hub (/api/ws)
Everything runs in Docker with host network mode so the SNMP UDP ports (1061, 1162) are reachable from the host.
Try It
# One‑command install
curl -fsSL https://raw.githubusercontent.com/tosumitdhaka/trishul-snmp/main/install-trishul-snmp.sh | bash
# Access at
http://localhost:8080
🐙 GitHub — tosumitdhaka/trishul-snmp
💬 v1.2.4 Announcement & Discussion — View discussion
📋 Full Changelog — View changelog
If it’s useful, a ⭐ on GitHub goes a long way — it helps other devs find the project.
Happy to answer questions in the comments about architecture decisions, the pysnmp/pysmi integration, or the WebSocket implementation. 🔱