Skip to content

Feature Request: Distributed Monitoring #910

@avargaskun

Description

@avargaskun

Feature Request: Distributed Monitoring (Agent Mode)

Problem Description

Currently, WUD is designed as a standalone application. To monitor containers on multiple different Docker hosts (e.g., in a homelab environment with multiple servers), a user must deploy a full WUD instance on each host.

This approach has several downsides:

  1. Security Risks: While WUD can currently monitor remote hosts by connecting to exposed Docker sockets (via TCP/HTTP), these sockets typically lack built-in authentication. Exposing them creates a significant security vulnerability.
  2. Fragmented UI: If running separate instances, the user has to check multiple dashboards to get the status of their infrastructure.
  3. Redundant Configuration: Notification triggers (e.g., Slack, Email, MQTT) must be configured identically on every instance.
  4. Resource Usage: Running full instances with persistence and UI on every edge node is inefficient.

Proposed Solution

I propose introducing a Distributed Architecture ("Agent Mode") to WUD.

This would allow WUD to run in two distinct modes:

  1. Controller Node: The central server. It maintains the persistent database, serves the unified Web UI, and executes notification triggers.
  2. Agent Node: A lightweight instance running on remote Docker hosts. It performs local container discovery and registry checks, then forwards the results to the Controller.

Architecture & Approach

1. Communication Protocol

The Controller will act as the client, establishing a connection to the Agents.

  • Transport: HTTP/HTTPS.
  • Real-time Updates: Agents will push state changes (Container Added/Updated/Removed) to the Controller via Server-Sent Events (SSE).
  • Security: Authentication via a shared secret header (X-Wud-Agent-Secret).

2. Responsibilities

  • Agent:
    • Discovery: Runs local Watchers (e.g., Docker socket) to find containers.
    • Analysis: Performs Registry checks locally. This ensures that the Agent (which likely has the correct network context/credentials) resolves the tags.
    • Stateless: Uses an in-memory store; no persistence to disk required.
  • Controller:
    • Aggregation: Receives Container objects from multiple Agents and merges them into its main store.
    • Visualization: Displays the source Agent in the UI.
    • Action: Manages Triggers. Notification triggers run locally on the Controller. Action triggers (like docker.restart) are proxied back to the specific Agent for execution.

3. Configuration Experience

This feature should be purely configuration-driven using environment variables.

Agent:

# Starts in Agent mode
WUD_AGENT_SECRET=mysecret
node index.js --agent

Controller:

# Connects to the agent
WUD_AGENT_NODE1_HOST=192.168.1.50
WUD_AGENT_NODE1_SECRET=mysecret

Benefits

  • Single Pane of Glass: One dashboard for all containers across the infrastructure.
  • Centralized Notifications: Configure Slack/Gotify once on the Controller; receive alerts for all Agents.
  • Scalability: Easier to manage 10+ hosts without juggling 10+ URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions