Overview
Introduction
The Ravenxcope Sensor Agent is a lightweight Go service that runs on each physical sensor host. It is the only software component that executes directly on sensor machines — all other RavenXcope services run on the defense center infrastructure.
The agent has two core responsibilities:
- Enrollment — On first startup, register the sensor host with the backend using a one-time install token, reporting hostname, OS, architecture, network interfaces, and IP address.
- Heartbeat — Periodically send system metrics (CPU, memory, network interface counters) to the backend so the defense center can monitor sensor health and online status.
Role in the Architecture
The agent communicates exclusively with the backend API over HTTP. It does not interact with the frontend, Ansible service, or any database directly.
Technology Stack
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Language | Go | 1.22 | Agent runtime |
| System Metrics | gopsutil | v3.24.5 | CPU, memory, and network I/O collection |
| Container Base | Alpine Linux | latest | Minimal Docker runtime |
| Build | Multi-stage Docker | — | Static Go binary in Alpine |
Agent Version
The current agent version is 2.0.0, defined as a constant in main.go. This version is reported to the backend during enrollment to track agent compatibility across the sensor fleet.
Key Design Principles
-
Single binary — The entire agent is a single Go binary (
main.go) with no external dependencies beyond the OS. -
Fail-fast on configuration — The agent exits immediately if required environment variables (
SENSOR_ID,BACKEND_URL) are missing. -
Enrollment-once model — The agent enrolls once using a one-time
INSTALL_TOKEN, receives a durableSENSOR_TOKEN, and persists it to disk. Subsequent restarts skip enrollment. -
Host network mode — The agent runs with Docker
--network hostto accurately detect and report host network interfaces and metrics. -
Host metadata passthrough — OS info and hostname are read from bind-mounted host files (
/host-os-release,/host-hostname) rather than container metadata. -
Resilient heartbeat loop — Failed heartbeats are logged but do not crash the agent. The ticker continues and retries on the next interval.
-
Minimal footprint — Docker resource limits cap the agent at 0.5 CPU and 256MB memory.