vm-observer: Monitoring the Edge with an Enterprise Backbone
How one developer used Apache Kafka and Go to turn simple VM telemetry into a resilient, event-driven stream.
- The system uses Apache Kafka to decouple data collection from the dashboard for enterprise-grade resilience.
- A single Base64-encoded string automates the entire configuration and deployment process for remote agents.
- The architecture ensures at-least-once delivery by buffering telemetry data in a persistent broker stream.
- The project demonstrates how to scale monitoring throughput by inserting a message broker between Go-based agents and a Laravel backend.
The Heavy-Duty Pipe
Most weekend projects designed to monitor virtual machines rely on simple architectures. They usually deploy a lightweight script that pings an HTTP endpoint or opens a WebSocket. The developer behind vm-observer chose a completely different path. They built a distributed system using Apache Kafka as the backbone.
This is architectural overkill for checking if a server is out of disk space. But that is exactly what makes the repository fascinating. It is a masterclass in applying Big Tech infrastructure to a Small Tech problem. By decoupling data collection from visualization, the system gains enterprise-grade resilience.
The architecture relies on a strict separation of concerns. A Go-based agent sits on the edge, pushing metrics into the Kafka broker. A Laravel application sits on the control plane, consuming those metrics at its own pace. If the dashboard goes down, the broker simply holds the messages. When the dashboard returns, it processes the backlog without losing a single data point.
The One-Line Onboarding
Deploying agents across a fleet of scattered VMs is notoriously painful. The vm-observer project solves this with a clever approach to configuration management. The entire connection profile is packed into a single Base64-encoded string.
When a user adds a new device in the dashboard, Laravel generates a unique UUID and bundles it with the Kafka server IP, topic name, and SASL credentials. The user then runs a single shell script on their target machine. This script downloads the Go agent, compiles it, and registers it as a systemd service using the provided string.
This design keeps the edge agent incredibly thin. It contains no complex parsing logic or local configuration files. It simply decodes the string, connects to the broker using SCRAM-SHA-512 authentication, and begins transmitting.
Consuming the Stream
The control plane is where the raw data becomes useful. Built on Laravel 11, the backend uses a dedicated Artisan command to act as a long-running Kafka consumer. This process listens to the broker stream, mapping incoming JSON payloads to database records using the device UUIDs.
To surface these updates in real-time, the project avoids heavy Single Page Application frameworks. Instead, it relies on Livewire. The dashboard components use Livewire's polling capabilities to refresh the UI automatically as the database updates.
Architecture vs. Simplicity
The decision to use an event-driven stream over traditional HTTP polling fundamentally changes the operational characteristics of the tool. It trades setup simplicity for inherent scalability.
| Feature | vm-observer (Kafka Stream) | Traditional Agent (HTTP Polling) |
|---|---|---|
| Transport | Event-driven (Push) | REST / HTTP (Pull) |
| Storage | Persistent Broker Stream | Direct to Database |
| Setup Complexity | High (Requires Kafka/Zookeeper) | Low (Standalone Binary) |
| Delivery Guarantee | At-least-once | Best-effort |
Traditional monitors often struggle when dealing with thousands of concurrent connections. The database becomes the bottleneck. By inserting Kafka into the ingest path, vm-observer pushes that concurrency limit out to the broker, which is explicitly designed to handle massive throughput.
The Origin and Vision
Building a tool like this requires balancing practical needs with architectural exploration. For a solo developer, the project serves as both a utility and a proving ground for robust system design.
vm-observer is a tool I built to easily monitor my VMs. It collects metrics and provides a simple dash.
The result is a system that feels familiar on the frontend but hides a surprisingly resilient engine under the hood. It proves that combining modern PHP frameworks with Go-powered edge agents and enterprise message brokers can yield reliable, decoupled observability stacks.