How valeriansaliou/vigil works
1. Vigil is a single Rust service that combines three major responsibilities: monitoring, alerting, and serving a public status page. The runtime is split into internal subsystems rather than separate services, but there are clear boundaries between probe ingestion, health aggregation, notifications, and HTTP response rendering.
2. src/main.rs is the composition root. It likely wires configuration, logging, the probe/aggregator loop, notifier backends, and the responder HTTP server into one process. The app is configured entirely from config.cfg plus environment-variable interpolation.
3. The configuration subsystem (src/config) is central to the architecture. It parses server settings, branding, probe definitions, notification targets, metrics thresholds, and plugin settings. It also includes defaults, regex helpers, and logger setup, so configuration is not just input data but the main control plane for how the service behaves.
4. The probing subsystem (src/prober) is the input side of the system. It supports four monitoring modes: poll for active checks, push for external reporters, script for shell-based checks, and local for reports coming from a separate Vigil Local daemon. This is where HTTP/TCP/SSH/ICMP reachability, application health, and local service status enter the system.
5. Probe execution is asynchronous and stateful. The mode, replica, report, states, and status modules suggest a normalized pipeline that turns raw probe results into a common health model. A node can report healthy, sick, or dead, with thresholds driven by the metrics configuration and per-node overrides.
6. The aggregator subsystem (src/aggregator) is the health decision layer. It consumes probe reports and turns them into service-level state, handling transitions, retries, and any logic required to compare multiple replicas or node signals. This is the point where raw check outcomes become the canonical status used by the rest of the app.
7. The notifier subsystem (src/notifier) is the outbound side effect layer. It has a shared abstraction plus channel-specific implementations for Email, Slack, Twilio, Zulip, Telegram, Pushover, Gotify, Matrix, Webex, XMPP, and Webhook. Notifications are triggered on status changes, startup, and optional reminders, so the architecture includes a clear event-to-notification path.
8. The responder subsystem (src/responder) is the public HTTP-facing layer. It serves the status page and related endpoints, renders templates from res/assets/templates, and uses static assets under res/assets for CSS/JS/images/fonts. It also contains dedicated routes for administrative and machine-oriented APIs.
9. There are two important API boundaries: the manager API and the reporter API. The manager side is authenticated by manager_token and is used for administrative actions such as announcements; the reporter side is authenticated by reporter_token and accepts health submissions from external Vigil Reporter libraries. The optional MCP server adds a read-only endpoint for AI/tooling access to probe data.
10. Announcements are a first-class public-facing feature, not an afterthought. They live in the responder layer, which means the status page can display operational messages independently from normal health state, likely driven by manager-authenticated writes.
11. External integrations materially shape the architecture. Vigil talks outward to SMTP, Twilio, Slack, Zulip, Telegram, Pushover, Gotify, Matrix, Webex, XMPP, and arbitrary webhooks; it can also query RabbitMQ via plugin configuration to evaluate queue health. These integrations sit behind dedicated adapter modules, keeping transport-specific code out of the core monitoring logic.
12. Probe execution has explicit security and runtime boundaries. Script probes run as shell subprocesses, ICMP probes require raw-socket capability, and local monitoring is offloaded to a separate Vigil Local daemon for LAN-restricted targets. That means the system intentionally spans multiple trust zones: public status serving, internal monitoring, and optional local agents.
13. Packaging and deployment are part of the repo structure: Docker, Debian packaging, GitHub Actions, and release scripts are included. This suggests the intended deployment model is a single long-running server binary, packaged for Linux distros or containerized, rather than a distributed microservice set.
Main entry points: routes.rs Routes · main.rs Main · config.rs Schema · mod.rs Notify core
Components 26
Source
Core Rust service code
- Main · Wires config, probing, aggregation, notifications, and HTTP serving
src/main.rs
Config
Configuration and logging control plane
- Reader · Loads and interpolates config.cfg and environment values
src/config/reader.rs - Schema · Defines server, branding, probes, notifications, metrics, and plugins
src/config/config.rs - Defaults · Provides fallback values and baseline settings
src/config/defaults.rs - Regex · Regex helpers used by configuration parsing and matching
src/config/regex.rs - Logger · Initializes logging from configuration
src/config/logger.rs
Prober
Probe ingestion and normalization
- Probe mgr · Coordinates probe execution and report collection
src/prober/manager.rs - Modes · Active poll, push, script, and local monitoring modes
src/prober/mode.rs - Replica · Models per-replica probe execution and state
src/prober/replica.rs - Report · Normalizes raw probe results into shared reports
src/prober/report.rs - States · Defines healthy, sick, and dead thresholds and transitions
src/prober/states.rs - Status · Canonical probe status used across the service
src/prober/status.rs
Aggregator
Health decision layer
- Health agg · Turns probe reports into service-level health decisions
src/aggregator/manager.rs
Notifier
Outbound alert adapters
- Notify core · Shared notification abstraction and dispatch logic
src/notifier/mod.rs - Email · SMTP email notification backend
src/notifier/email.rs - Slack · Slack notification backend
src/notifier/slack.rs - Webhook · Generic webhook notification backend
src/notifier/webhook.rs
Responder
HTTP status and API layer
- Routes · Public endpoints for status, APIs, and responses
src/responder/routes.rs - Announcements · Operational announcements shown on the status page
src/responder/announcements.rs - Manager API · Authenticated administrative actions using manager_token
src/responder/manager.rs - MCP · Optional read-only endpoint for tooling access
src/responder/mcp.rs - Context · Builds rendering context for status and API responses
src/responder/context.rs - Payload · Defines response bodies and API payload shapes
src/responder/payload.rs
Assets
Static UI assets and templates
- Status page · Primary Tera template for the public status page
res/assets/templates/index.tera - Styles · Stylesheets for the public status page
res/assets/stylesheets/index.css - Scripts · Client-side behavior for the public status page
res/assets/javascripts/index.js
Connections 32
- Main → Reader: loads · Bootstraps runtime settings from config and environment
- Main → Logger: initializes · Sets up logging before other subsystems
- Main → Probe mgr: starts · Runs probe ingestion and monitoring loops
- Main → Health agg: wires · Connects probe outputs to health aggregation
- Main → Notify core: starts · Enables outbound notifications
- Main → Routes: serves · Starts the public HTTP responder
- Reader → Schema: parses · Fills the central configuration model
- Schema → Defaults: uses · Applies fallback values
- Schema → Regex: uses · Supports pattern-based matching and validation
- Schema → Probe mgr: configures · Supplies probe definitions and runtime thresholds
- Schema → Notify core: configures · Supplies notification targets and triggers
- Schema → Routes: configures · Supplies server, branding, and API settings
- Probe mgr → Modes: orchestrates · Dispatches work across monitoring modes
- Probe mgr → Replica: tracks · Handles replica-aware execution
- Modes → Report: emits · Produces normalized probe reports
- Replica → States: updates · Maps execution outcomes to health thresholds
- Report → Status: normalizes · Converts raw results into canonical status
- Status → Health agg: feeds · Provides canonical health input to aggregation
- Health agg → Notify core: triggers · Raises alerts on meaningful state changes
- Health agg → Context: publishes · Exposes current service health to the UI layer
- Notify core → Email: adapts · Sends email notifications
- Notify core → Slack: adapts · Sends Slack notifications
- Notify core → Webhook: adapts · Sends webhook notifications
- Routes → Context: builds · Prepares view state and API context
- Routes → Announcements: serves · Displays and updates announcements
- Routes → Manager API: exposes · Hosts manager-authenticated admin actions
- Routes → MCP: exposes · Hosts optional read-only tooling access
- Routes → Payload: serializes · Formats JSON and API payloads
- Context → Status page: renders · Feeds the public status page template
- Context → Styles: uses · Pairs UI state with static styling
- Context → Scripts: uses · Pairs UI state with client-side behavior
- Announcements → Payload: shares · Reuses response shapes for announcement data