Install Dependency
Install Prometheus
sudo apt-get install -y prometheus prometheus-node-exporter
Install Grafana
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" > grafana.list
sudo mv grafana.list /etc/apt/sources.list.d/grafana.list
sudo apt-get update && sudo apt-get install -y grafana
Konfigurasi Dashboard
Konfigurasi Prometheus
cat > $HOME/prometheus.yml << EOF
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: "prometheus"
scrape_interval: 5s
static_configs:
- targets: ["localhost:9090"]
- job_name: "avail_node"
scrape_interval: 5s
static_configs:
- targets: ["localhost:9615"]
- job_name: node
static_configs:
- targets: ['localhost:9100']
EOF
Pindahkan file prometheus.yml
sudo mv $HOME/prometheus.yml /etc/prometheus/prometheus.yml
Update permission
sudo chmod 644 /etc/prometheus/prometheus.yml
Menjalankan Prometheus saat boot
sudo systemctl enable prometheus.service prometheus-node-exporter.service
Restart Prometheus
sudo systemctl restart prometheus.service prometheus-node-exporter.service
Cek status Prometheus. Pastikan statusnya AKTIF dan tidak ada error
sudo systemctl status prometheus.service prometheus-node-exporter.service
Konfigurasi Grafana
Menjalankan Grafana saat booting
sudo systemctl enable grafana-server.service
Menjalankan service Grafana
sudo systemctl start grafana-server.service
Cek status Grafana. Pastikan statusnya AKTIF dan tidak ada error
sudo systemctl status grafana-server.service
Menjalankan Dashboard
Buka port
sudo ufw allow 3000/tcp
buka di web browser dengan IPVPS:3000
Login Bawaan
Username: admin
Password: admin
ubah password dan tambahkan data source
pilih prometheus
Masukkan localhost:9090 di Prometheus server URL lalu scroll ke bawah klik Save
Download https://github.com/availproject/availproject.github.io/blob/6ff2c1862ede87225a1b6ee296ea5762f56f4042/static/grafana/Avail-Node-Metrics.json dan Import file json tadi di Home > Icon + > Import Dashboard
Buka browsermu lalu ketik IPVPS:3000 untuk membuka grafana lalu pilih dashboard