Monitoring
Server Monitoring with Prometheus and Grafana
- Author :Liam K.
- Date :March 08, 2026
- Time :19 minutes
Architecture Overview
Node Exporter runs on monitored servers. Prometheus scrapes these metrics. Grafana visualizes and alerts on top of Prometheus data.
Step 1: Install Node Exporter on Target Server
bash
cd /tmp
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz
sudo cp node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin/
sudo useradd --no-create-home --shell /bin/false node_exporter || trueStep 2: Create systemd Service for Node Exporter
bash
sudo tee /etc/systemd/system/node_exporter.service >/dev/null <<'EOF'
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
[...]Command truncated. Copy to view full command.
Step 3: Install Prometheus and Grafana via Docker Compose
bash
mkdir -p ~/monitoring/{prometheus,grafana}
cd ~/monitoringyaml
cat > prometheus/prometheus.yml <<'EOF'
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: node_exporter
[...]Command truncated. Copy to view full command.
yaml
cat > docker-compose.yml <<'EOF'
services:
prometheus:
image: prom/prometheus:v2.54.1
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
volumes:
[...]Command truncated. Copy to view full command.
Step 4: Add Prometheus Data Source in Grafana
Open Grafana at http://SERVER_IP:3000, log in with admin/admin, then add Prometheus at http://prometheus:9090.
Step 5: Import Dashboard
Import Node Exporter Full dashboard (ID 1860) and map it to your Prometheus data source.
Step 6: Create Basic Prometheus Alerts
yaml
cat > prometheus/alerts.yml <<'EOF'
groups:
- name: node_alerts
rules:
- alert: HostHighCPU
expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 85
for: 10m
labels:
[...]Command truncated. Copy to view full command.
yaml
# Add to prometheus.yml
rule_files:
- /etc/prometheus/alerts.ymlbash
# Mount alerts file in docker-compose and restart
# - ./prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
docker compose restart prometheus"Monitoring is only useful if alerts are actionable and linked to an operational response."
Technical Author

Liam K.
System administrator and technical writer specializing in server infrastructure, security and deployment. Creating comprehensive guides to help you master server administration.
Related Guides
Ansible Dynamic Inventory for AWS at Scale
March 08, 2026
Ansible Role Testing with Molecule and CI Pipelines
March 08, 2026