How neonight-d/moonlan works
MoonLan is a self-hosted LAN discovery and monitoring service. Switches are polled over SNMP; collected device data feeds topology inference, which produces the map state served by the API and web interface. The product also includes monitoring and stateful alarms, operational controls, diagnostics, and role-protected access. The README documents the major flow and capabilities; sampled source and the SOURCE INDEX support some internal links, while unsampled implementation details are not expanded into speculative call chains.
Main entry points: snmp_collector.py SNMP collector · topology.py HTTP API routes · poller.py Polling and counters · server.py Service and routing
Components 23
Discovery and mapping
- SNMP collector
moonlan/snmp_collector.py - SNMP enrichments
moonlan - Topology inference
moonlan/topology.py - Map construction
moonlan/mapping/build.py - Router identity
moonlan/routers.py - Virtual network demo
moonlan/demo.py
Monitoring and alarms
- Polling and counters
moonlan/poller.py - Counter rates
moonlan/counters.py - Stateful alarms
moonlan/alarms.py - Alarm text catalogue
moonlan/alarm_texts.py - Notifications
moonlan/notify.py
Service and storage
- SQLite persistence
moonlan/db.py - Runtime state
moonlan/runtime.py - Service and routing
moonlan/server.py
Access and operations
- Sign-in and sessions
moonlan/signin.py - Route permissions
moonlan/access.py - Live settings
moonlan/settings.py - Network diagnostics
moonlan/diag.py
API and interface
- HTTP API routes
moonlan/routes/topology.py - Web interface
web/app.js
Other components
- SNMP switches
- Network operator
- Email, Telegram, Syslog
Connections 24
- SNMP switches → SNMP collector: provide SNMP data
- SNMP collector → Topology inference: supplies readings
moonlan/topology.py - SNMP collector → SNMP enrichments: collects protocols
moonlan/snmp_collector.py - SNMP collector → Router identity: uses router data
moonlan/snmp_collector.py - Topology inference → Map construction: builds map
moonlan/mapping/build.py - Virtual network demo → SNMP collector: provides virtual readings
moonlan/demo.py - Polling and counters → SNMP collector: polls devices
- Polling and counters → Counter rates: tracks counters
- Polling and counters → Stateful alarms: updates alarms
- Stateful alarms → Alarm text catalogue: formats messages
- Stateful alarms → Notifications: sends alarm events
- Notifications → Email, Telegram, Syslog: delivers notices
- Topology inference → SQLite persistence: persists state
- Service and routing → Runtime state: initializes service state
moonlan/runtime.py - Service and routing → SQLite persistence: configures persistence
moonlan/server.py - Service and routing → HTTP API routes: registers routes
moonlan/server.py - HTTP API routes → Runtime state: reads service state
moonlan/routes/topology.py - HTTP API routes → Sign-in and sessions: uses request guard
moonlan/routes/topology.py - Sign-in and sessions → Route permissions: checks route roles
moonlan/signin.py - Sign-in and sessions → SQLite persistence: looks up accounts
moonlan/signin.py - HTTP API routes → Live settings: serves settings controls
- Network operator → Web interface: uses map interface
- Web interface → HTTP API routes: requests map data
- Network operator → Network diagnostics: runs diagnostics