Monitoring a Fleet of Servers with a Containerized Client
Extend Your Monitoring to Multiple Hosts
Once you have a central monitoring server, how do you collect metrics and logs from other servers? The ‘Ubuntu System Administration Guide’ details how to create a lightweight ‘client’ stack using Podman or Docker to turn any server into a monitored node.
The Client Stack
On each server you want to monitor, you’ll deploy a simple `docker-compose.yaml` file that runs two services:
- Node Exporter: To collect system metrics.
- Promtail: To collect logs.
Sending Data Back
The key is in the configuration. The client’s Promtail instance is configured with the URL of your central Loki server. For metrics, you’ll update the `prometheus.yml` file on your central server to add the IP addresses of the new client Node Exporters to its list of ‘targets’ to scrape. This hub-and-spoke model allows you to easily scale your monitoring to cover your entire infrastructure.
This post is based from content of the book Ubuntu System adminstration guide. And the book can be found here https://www.amazon.com/stores/Mattias-Hemmingsson/author/B0FF5CQX13