Building an Alerting Pipeline from Scratch: Prometheus, Alertmanager, and the Alert That Actually Fired
Reading about monitoring is one thing. Getting an actual alert to land in your inbox at 2am — well, in my case, on demand, during a test — is another. I wanted to understand observability the way an SRE actually experiences it: not as a diagram in a slide deck, but as a pipeline you build, break, and fix yourself. So I set out to build a minimal but complete monitoring and alerting stack:…
Building a monitoring and alerting system from scratch offers a hands-on understanding of observability that goes beyond theoretical diagrams. In this project, Prometheus was used for metrics collection, node_exporter exposed host metrics, and Alertmanager routed alerts to a real inbox via Gmail SMTP. Running on Docker Compose, the stack initially seemed simple, but each layer presented its own unique challenges.
YAML's whitespace sensitivity caused issues with configuration files, leading to silent failures in the scrape and rule evaluation processes. Writing effective alerting rules required mastering PromQL, a query language specific to Prometheus. The final step was configuring Alertmanager to send email through Gmail's SMTP relay, which involved setting up an app password and ensuring the route and receiver blocks in Alertmanager matched the labels from Prometheus.
To confirm the pipeline's functionality, the test involved stopping node_exporter, causing Prometheus to fail in scraping the target, up to flip to 0, triggering the InstanceDown rule, and finally, Alertmanager sending an email. This end-to-end test demonstrated that the entire alerting pipeline was working seamlessly. Through this project, the reporter learned key lessons about SRE work, such as viewing alerting as a system rather than a standalone feature, understanding that every layer can fail silently, and the importance of precision in observability.
The debugging process, including handling YAML indentation errors and label-matching mismatches, was highlighted as the critical skill in this workflow. Looking forward, the next steps include adding visualization capabilities with Grafana and implementing more complex alerting rules based on Service Level Objective (SLO) burn rates, which mirrors real-world production environments.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.