Monitoring Promeotheus & Grafana
Pasang Node Exporter (di server yang mau dimonitor)
Node Exporter harus dijalankan di setiap host yang ingin dimonitor.
- Download binary terbaru (contoh cara manual — ganti versi bila perlu):
cd /tmp
VERSION=1.8.2
wget https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz
tar xzf node_exporter-${VERSION}.linux-amd64.tar.gz
mv node_exporter-${VERSION}.linux-amd64/node_exporter /usr/local/bin/
tee /etc/systemd/system/node_exporter.service > /dev/null <<'EOF'
[Unit]
Description=Prometheus Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now node_exporter
sudo systemctl status node_exporter --no-pager
- Tes dari localhost / remote:
Pasang Prometheus (bisa di server monitoring terpisah atau sama)
- Download Prometheus:
cd /tmp
PROM_VER=2.47.0 # contoh; sesuaikan bila perlu
wget https://github.com/prometheus/prometheus/releases/download/v${PROM_VER}/prometheus-${PROM_VER}.linux-amd64.tar.gz
tar xzf prometheus-${PROM_VER}.linux-amd64.tar.gz
cp -r prometheus-${PROM_VER}.linux-amd64/* /opt/prometheus
- Struktur file dan user:
useradd -rs /bin/false prometheus
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo mv /opt/prometheus/prometheus /opt/prometheus/promtool /usr/local/bin/
rm -rf /etc/prometheus/consoles /etc/prometheus/console_libraries
sudo mv /opt/prometheus/consoles /opt/prometheus/console_libraries /etc/prometheus/
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /usr/local/bin/prometheus /usr/local/bin/promtool
- Buat prometheus.yml minimal di /etc/prometheus/prometheus.yml:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['127.0.0.1:9100'] # ganti dengan IP host jika node_exporter di host lain
sudo tee /etc/systemd/system/prometheus.service > /dev/null <<'EOF'
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.listen-address=0.0.0.0:9090
[Install]
WantedBy=multi-user.target
EOF
- Mulai Prometheus:
- Buka web UI Prometheus (di browser): http://
:9090/targets — di sini kamu harus melihat node_exporter sebagai UP.
Jika node_exporter di host lain, tambahkan IP host pada targets (contoh 192.168.1.10:9100).
Pasang Grafana
apt update
apt install -y apt-transport-https software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
apt update
apt install -y grafana
Aktifkan dan jalankan:
Akses Grafana di browser: http://
## Hubungkan Grafana ke Prometheus
- Login Grafana -> connections - Add data sources


Save and test (paling bawah)
Membuat Dashboard
cari template dashboard di
https://grafana.com/grafana/dashboards/
ke bawah copy ID nya
Masukkan ID nya kemudian Load