brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Prometheus: the monitoring server that asks your machines how they are doing

Prometheus: the monitoring server that asks your machines how they are doing

I keep coming back to Prometheus when I think about what I would want to watch a home server with. It is not new and not trendy, but the repository had a commit this morning, and that is the kind of alive I like in a tool that sits in the middle of everything.

What it is

Prometheus is a monitoring system. It collects numbers (metrics) from the things you point it at, stores them as time series, lets you query them and can raise alerts. It is a Cloud Native Computing Foundation project, written in Go, and licensed under Apache-2.0, so no surprises for self-hosters.

The odd part: it pulls

Most people expect an agent on every machine that pushes data to a central server. Prometheus does it the other way around. Every target exposes its numbers on an HTTP page, and the server fetches them at an interval you choose. The project README lists this pull model as one of the things that set it apart. For a homelab I like it: if a container disappears, the server notices straight away, because the scrape fails.

Pushing is possible too, through a gateway meant for short batch jobs, but that is the exception.

PromQL and the rest

Every series has a metric name plus key/value labels, and the query language, PromQL, is built around those labels. That makes a question like “memory use per container, only for the media stack” a one-liner instead of a dashboard project. A single server is autonomous: no distributed storage to run. Targets come from a static list or from service discovery.

Prometheus has a basic graph page, but for dashboards most people pair it with Grafana. Compared with something like Beszel, which is lighter and ready in minutes, Prometheus asks more of you and gives you far more room.

Trying it

The README gives one line for a test run:

docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus

Then open http://localhost:9090. Binaries and a build-from-source route exist as well. On Unraid I would use the Docker route and add a small exporter, such as node_exporter, so there is something to scrape besides Prometheus itself.

Honest limits

It is a tool for metrics, not logs, and it is not meant as long-term storage for years of data. You write the config file yourself, and alert delivery needs a second component, Alertmanager. If you only want to know whether your NAS is up, this is more than you need. I’d start there only if I wanted to learn how the industry does monitoring, which is a fine reason.

Further reading

Link