Monitor Module Overview
The monitor package provides internal infrastructure monitoring and health checks for the dLANDiscord ecosystem.
Key Features
- Protocol Support: Supports monitoring via HTTP(S), ICMP (Ping), TCP, and specialized game protocols (e.g., Pelican).
- Alert Management: Aggregates and debounces alerts before routing them to agents or notification channels.
- Database Integration: Stores monitoring targets and historical uptime data in a dedicated database.
- Dashboard API: Provides data for the infrastructure tabs in Mission Control.
Key Files & Directories
monitor/monitor.go: The central monitoring engine.monitor/internal/config/: Configuration management for monitoring targets.monitor/internal/monitor/: Implementations of different monitoring protocols.monitor/internal/handlers/: API handlers for monitoring data.
Integration Flow
- Polling: The monitoring engine periodically checks the status of all configured targets.
- State Change: If a target's status changes (e.g., Up → Down), an alert is generated.
- Debouncing: Related alerts are grouped to prevent notification storms.
- Notification: Alerts are sent to the
assistantmodule or directly to notification channels (WhatsApp/Discord).
Mermaid Diagram: Monitoring Flow
graph TD
M[Monitor Engine] --> P[Protocol: HTTP/Ping/TCP]
P --> T[Target: e.g. Gadgetzan]
T -- Status --> M
M --> D{Status Changed?}
D -- Yes --> A[Generate Alert]
A --> DB[Debounce Logic]
DB --> N[Notify User / Agent]
Guidance for AI Agents
- Infrastructure Context: Use the
infra_statustools to get real-time data from the monitor module during troubleshooting tasks. - Alert Investigation: When an alert is received, use the
sysadminorsashaagents to perform an automated investigation of the affected server.