Skip to content

Epic: Cross-platform daemon/service mode for daemoneye-agent (Unix/macOS/Windows) with process supervision #103

@unclesp1d3r

Description

@unclesp1d3r

Cross-platform Daemon/Service Mode for daemoneye-agent

Summary

Implement a first-class, cross-platform service/daemon mode for the daemoneye-agent (Orchestrator) using the proc-daemon crate that:

  • Runs as a native background service on Linux/macOS (daemon) and Windows (service)
  • Supervises collector processes (e.g., procmond and specialty collectors) with robust lifecycle management
  • Integrates with system service managers (systemd, launchd, Windows SCM)
  • Preserves parity with interactive mode while adding secure privilege management, logging, health, and recovery

🏗️ Architecture Integration: This issue implements the service foundation that enables daemoneye-agent to manage collector-core based components like procmond as described in issue #89.

Context & Motivation

This is a core building block to operate DaemonEye reliably on servers and endpoints, ensuring automatic startup at boot, robust recovery, and centralized control of all monitoring components.

  • Critical for production deployments and unattended operation (blocking adoption)
  • Ensures proper privilege separation and least-privilege runtime
  • Enables standardized installation, logging, and observability across Linux, macOS, and Windows
  • Provides resilient supervision for collector processes with health checks and backoff restarts

Architecture Integration

Service Hierarchy

Operating System
├── Service Manager (systemd/launchd/SCM)
│   └── daemoneye-agent (proc-daemon based service)
│       ├── Process Supervision
│       │   ├── procmond (collector-core based)
│       │   ├── netmond (collector-core based)  
│       │   └── filemond (collector-core based)
│       ├── Configuration Management
│       ├── Health Monitoring
│       └── IPC Coordination
└── System APIs & Resources

Integration Points

  • Issue Implement Core Process Monitoring Daemon (procmond) #89: procmond implementation will run as managed collector under this service
  • collector-core: All collectors use this framework and are supervised by daemoneye-agent
  • proc-daemon: Core service behavior and cross-platform daemon functionality
  • daemoneye-lib: Shared configuration, IPC, and telemetry infrastructure

Technical Requirements

Service Framework Implementation

  • proc-daemon Integration
    • Integrate proc-daemon crate for cross-platform service behavior
    • Handle service installation, start, stop, restart operations
    • Implement service status reporting and health monitoring
    • Support service configuration management

Cross-Platform Service Management

  • Linux/macOS Daemon Support

    • systemd service integration with proper service files
    • launchd integration for macOS
    • UNIX signal handling (SIGTERM, SIGHUP, SIGUSR1)
    • PID file management and process locking
  • Windows Service Support

    • Windows Service Control Manager (SCM) integration
    • Service installation and uninstallation
    • Windows service events and logging
    • Service recovery configuration

Collector Process Supervision

  • Lifecycle Management

    • Start, stop, restart collector processes (procmond, etc.)
    • Health monitoring and automated recovery
    • Graceful shutdown coordination
    • Process resource monitoring and limits
  • Configuration Management

    • Hot-reload configuration without service restart
    • Per-collector configuration validation
    • Configuration change propagation
    • Environment isolation for collectors

Implementation Phases

Phase 1: Service Foundation

  1. proc-daemon Integration

    • Add proc-daemon crate dependency to daemoneye-agent
    • Implement basic service lifecycle (start, stop, status)
    • Create service installation/uninstallation logic
    • Add cross-platform service configuration
  2. Platform Integration

    • Create systemd service files for Linux
    • Implement launchd plist for macOS
    • Add Windows service manifest and installer
    • Test service registration on all platforms

Phase 2: Process Supervision

  1. Collector Management

    • Implement collector process spawning and monitoring
    • Add health check integration with collector-core
    • Create configuration distribution system
    • Implement graceful shutdown coordination
  2. Recovery & Resilience

    • Add automatic restart capabilities
    • Implement circuit breaker patterns
    • Create resource monitoring and cleanup
    • Add performance metrics collection

Dependencies

  • proc-daemon: Core service/daemon functionality
  • collector-core: Framework for all managed collectors
  • daemoneye-lib: Shared infrastructure (config, IPC, telemetry)
  • procmond: Primary collector to be supervised (Issue Implement Core Process Monitoring Daemon (procmond) #89)
  • Platform service managers (systemd, launchd, Windows SCM)

Acceptance Criteria

Service Operation

  • Cross-platform Compatibility

    • Successfully installs and runs on Linux, macOS, and Windows
    • Integrates with native service managers on each platform
    • Handles platform-specific service requirements
  • Service Lifecycle

    • Service starts automatically at boot
    • Responds correctly to start, stop, restart commands
    • Handles graceful shutdown and cleanup
    • Supports service status queries

Collector Supervision

  • Process Management
    • Successfully starts and monitors collector processes
    • Detects and recovers from collector failures
    • Coordinates graceful shutdown of all components
    • Reports aggregate health status

Timeline

Target completion aligned with v0.2.0 milestone (Due: September 22, 2025)

Related Issues


This issue enables the core service architecture that makes DaemonEye a production-ready monitoring platform.

Metadata

Metadata

Assignees

Labels

configurationConfiguration management and settingscore-featureCore system functionalitycross-platformMulti-platform compatibility featuresenhancementNew feature or requestepicParent issue for larger effortsintegrationRelated to integration testing and component integrationpriority:highHigh priority issue that should be addressed soonprocess-monitoringProcess monitoring and enumeration featurestestingRelated to test development and test infrastructure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions