Centralized Monitoring and Alerting
Scale monitoring beyond a single server: ship metrics and logs to a central system, build dashboards, and configure alerts so you learn about problems before your users do.
Centralized Monitoring and Alerting is a free Linux Server Deployment & SSH Mastery lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Linux Server Deployment & SSH Mastery learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Centralize?
Logging into each server with top and journalctl works for one machine. With many servers it does not scale, and you only see problems when you happen to look.
Centralized monitoring collects metrics and logs from all servers into one place, with dashboards and automatic alerts.
Metrics vs Logs
Two kinds of data drive observability:
- Metrics — numeric time-series like CPU %, memory, request rate
- Logs — discrete text events like errors and access entries
You usually collect both, with different tools optimized for each.
The Prometheus Model
Prometheus is a popular metrics system. It pulls metrics by scraping HTTP endpoints that each server exposes.
On each server you run an exporter — node_exporter for host metrics — that publishes data Prometheus reads.
# On each monitored server:
sudo apt install prometheus-node-exporter
curl http://localhost:9100/metrics | headConfiguring a Scrape Target
Prometheus is told what to scrape via its config file. Each job lists targets (host:port of an exporter).
This snippet scrapes node_exporter on two servers.
scrape_configs:
- job_name: 'nodes'
static_configs:
- targets: ['web1:9100', 'web2:9100']Querying Metrics with PromQL
Prometheus has its own query language, PromQL. You can compute rates, averages, and more across your fleet.
This expression estimates per-server CPU usage.
100 - (avg by (instance) (rate(node_cpu_seconds_total{mode='idle'}[5m])) * 100)Visualizing with Grafana
Grafana connects to Prometheus (and many other sources) to build dashboards. You add Prometheus as a data source, then create panels from PromQL queries.
Pre-built dashboards for node_exporter give you CPU, memory, disk, and network graphs in minutes.
sudo apt install grafana
sudo systemctl enable --now grafana-server
# Open http://server:3000 and add Prometheus as a data sourceCentralizing Logs
For logs, ship them from each server to a central store. A common stack is Loki with Promtail, which integrates with Grafana.
Promtail runs on each server and forwards log files and the journal to Loki.
# promtail tails the journal and ships to Loki
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: journal
journal:
max_age: 12hDefining Alert Rules
Alerting turns metrics into action. Prometheus alert rules fire when an expression stays true for a duration.
This rule alerts when a node has been down for two minutes.
groups:
- name: node
rules:
- alert: NodeDown
expr: up == 0
for: 2m
labels:
severity: critical
annotations:
summary: 'Instance {{ $labels.instance }} is down'Routing Alerts
Alertmanager receives fired alerts and routes them to the right place: email, Slack, PagerDuty, and more. It also deduplicates and silences alerts.
You map alerts to receivers based on labels like severity.
route:
receiver: 'team-slack'
receivers:
- name: 'team-slack'
slack_configs:
- channel: '#alerts'Avoiding Alert Fatigue
Too many alerts are as bad as none — people start ignoring them. Good alerting:
- Alerts on symptoms users feel, not every metric blip
- Uses a
forduration to avoid flapping - Assigns severity so noise can be filtered
Best Practices
Build observability that lasts:
- Collect both metrics and logs centrally
- Start from community dashboards, then customize
- Alert on actionable conditions only
- Test that alerts actually reach you
Quick Check
Test your centralized monitoring knowledge.
Recap
You can now monitor a whole fleet centrally:
- Metrics via Prometheus scraping node_exporter, queried with PromQL
- Dashboards in Grafana
- Logs shipped to Loki via Promtail
- Alerts with Prometheus rules routed by Alertmanager
This extends single-server log skills into proactive, fleet-wide observability.
Frequently asked questions
Is the “Centralized Monitoring and Alerting” lesson free?
Yes — the full text of “Centralized Monitoring and Alerting” is free to read here on the web, and the Linux Server Deployment & SSH Mastery course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Linux Server Deployment & SSH Mastery course, upgrade to CoddyKit PRO.
What will I learn in “Centralized Monitoring and Alerting”?
Scale monitoring beyond a single server: ship metrics and logs to a central system, build dashboards, and configure alerts so you learn about problems before your users do. You practise Linux Server Deployment & SSH Mastery with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Linux Server Deployment & SSH Mastery?
No prior experience is required. Linux Server Deployment & SSH Mastery on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Centralized Monitoring and Alerting” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Linux Server Deployment & SSH Mastery lesson?
Yes. Every Linux Server Deployment & SSH Mastery lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- System Monitoring Tools
- Understanding System Logs
- Log Rotation and Archiving
- Centralized Monitoring and Alerting