Prometheus (metrics storage) + Grafana (visualization) — the open-source standard for monitoring. Deploy in 15 min via Docker Compose. Prometheus scrapes /metrics endpoints of your apps + Node exporter (system metrics). Grafana connects to Prometheus as a data source, shows dashboards. No lock-in: all open-source, self-hosted.
Below: step-by-step, working examples, common pitfalls, FAQ.
Free online tool — HTTP header checker: instant results, no signup.
docker compose up -d| Scenario | Config |
|---|---|
| docker-compose.yml | services:
prometheus:
image: prom/prometheus
ports: ["9090:9090"]
volumes: [./prometheus.yml:/etc/prometheus/prometheus.yml]
grafana:
image: grafana/grafana
ports: ["3000:3000"]
environment:
- GF_SECURITY_ADMIN_PASSWORD=change_me |
| prometheus.yml | scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['host.docker.internal:9100']
- job_name: 'app'
metrics_path: '/metrics'
static_configs:
- targets: ['app:8080'] |
| Node exporter | docker run -d --name node-exporter \
--net="host" --pid="host" \
-v /:/host:ro \
prom/node-exporter --path.rootfs=/host |
| PromQL query (CPU idle) | rate(node_cpu_seconds_total{mode="idle"}[5m]) |
| Alert rule | groups:
- name: example
rules:
- alert: HighCPU
expr: rate(node_cpu_seconds_total{mode!="idle"}[5m]) > 0.9
for: 5m |
To set up Prometheus and Grafana in 2026, install Prometheus using the official binaries or Docker, configure a YAML file for your data sources, and start the service. Then, install Grafana, connect it to your Prometheus instance, and create dashboards to visualize your metrics. This setup provides robust monitoring for your web infrastructure.
Setting up Prometheus involves several critical steps to ensure effective monitoring of your systems. Below is a detailed guide on how to install and configure Prometheus in a typical environment.
Prometheus can be installed using pre-compiled binaries or Docker. Below is the method using binaries:
wget https://github.com/prometheus/prometheus/releases/download/v2.42.0/prometheus-2.42.0.linux-amd64.tar.gztar xvf prometheus-2.42.0.linux-amd64.tar.gzcd prometheus-2.42.0.linux-amd64prometheus.yml file before you start the service. The default configuration file can be found in the extracted folder../prometheus --config.file=prometheus.ymlOpen the prometheus.yml file in a text editor and add your targets under the scrape_configs section. Here’s an example configuration:
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']This configuration tells Prometheus to scrape metrics from a Node Exporter running on the same machine.
To verify that Prometheus is running correctly, open your web browser and navigate to http://localhost:9090. You should see the Prometheus UI where you can explore your metrics.
If you want to gather system metrics, install Node Exporter:
wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gztar xvf node_exporter-1.5.0.linux-amd64.tar.gz
cd node_exporter-1.5.0.linux-amd64
./node_exporterNode Exporter will listen on port 9100 by default, which you can add to your Prometheus configuration.
After configuring Prometheus, you can set up Grafana for visualization:
wget https://dl.grafana.com/oss/release/grafana-9.6.1.linux-amd64.tar.gztar -zxvf grafana-9.6.1.linux-amd64.tar.gz
cd grafana-9.6.1
./bin/grafana-server webOnce Grafana is running, access it at http://localhost:3000. Log in using the default credentials (username: admin, password: admin). After logging in:
http://localhost:9090 and save.Now that Grafana is connected to Prometheus, you can create dashboards to visualize your metrics:
This process allows you to visualize metrics such as CPU usage, memory consumption, and more, providing valuable insights into your system's performance.
Prometheus — pull model, simple setup, TSDB. InfluxDB — push model, SQL-like queries, better long-term. Prometheus wins in Kubernetes/microservices.
Default 15 days. Long-term — remote storage (Thanos, Cortex, Grafana Mimir) or Prometheus federation.
Alertmanager (separate service). Routes alerts to email, Slack, PagerDuty, Telegram.
Prometheus+Grafana — self-hosted, free. Datadog — SaaS, $15+/host/mo, better UX. Pick by budget vs control.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.