Monitoring
Difficulty: Advanced
14 min read

Prometheus + Grafana: Complete Monitoring Stack

Step-by-step guide to install and configure a monitoring stack with Prometheus, Grafana and Alertmanager on a Linux infrastructure.

Back to tutorials
Prometheus + Grafana monitoring stack
This tutorial covers the complete deployment of a monitoring stack with Prometheus for metrics collection, Grafana for visualization, Node Exporter for system metrics and Alertmanager for notifications. By the end of this guide, you will have a working monitoring infrastructure capable of monitoring your servers and alerting you when something goes wrong.

Prerequisites

  • Operating system: Debian 12+ or Ubuntu 22.04+ (the commands can be adapted to CentOS/RHEL)
  • Privileges: Root or sudo access on the monitoring server
  • Resources: Minimum 2 GB of RAM and 20 GB of disk space (adjust according to the number of targets)
  • Network: Ports 9090 (Prometheus), 9100 (Node Exporter), 3000 (Grafana), 9093 (Alertmanager) accessible
  • Knowledge: Basics of Linux administration and systemd service management

Stack architecture

Prometheus works on a pull model: it is the Prometheus server that periodically queries the targets to retrieve their metrics. This model has several advantages over push (StatsD/Graphite style):

  • Prometheus: Central server that scrapes metrics over HTTP, stores them locally as time series and evaluates alerting rules
  • Exporters: Lightweight agents that expose metrics in the Prometheus format on a /metrics endpoint. The most common is node_exporter for system metrics
  • Grafana: Visualization interface that connects to Prometheus as a data source to create interactive dashboards
  • Alertmanager: Component that receives the alerts fired by Prometheus, deduplicates them, groups them and routes them to the right recipients (email, Slack, PagerDuty)

+------------------+       +-------------------+       +------------------+
|   Node Exporter  | <---- |    Prometheus      | ----> |   Alertmanager   |
|   (port 9100)    |       |    (port 9090)     |       |   (port 9093)    |
+------------------+       +-------------------+       +------------------+
                                    |
                                    v
                           +-------------------+
                           |     Grafana        |
                           |    (port 3000)     |
                           +-------------------+

Premium Content

This advanced tutorial is reserved for premium members.

9,90€ / month
  • All advanced tutorials
  • New content every week
  • Progress tracking
  • Cancel anytime

Written by

Morgann Riu

Cybersecurity and Linux administration expert. I share my knowledge through free tutorials and training to help system administrators and developers secure their infrastructures.

Share this tutorial

Did you enjoy this article?

Comments

Checklist Sécurité Linux

30 points essentiels pour sécuriser un serveur Linux. Recevez aussi les nouveaux tutoriels par email.

Pas de spam. Désabonnement en 1 clic.