Halo Gaes,
Pada jurnal kali ini kita akan coba untuk menginstall Node Exporter pada Ubuntu dan mem-visualisasikan hasil dari metric Node Exporter tersebut kedalam Dashboard Grafana. Secara garis besar Node Exporter disini berfungsi sebagai agent untuk mengubah data-data pada server menjadi metric, kemudian metrics tersebut kita lempar ke Prometheus dan di visualisasikan metric itu kedalam Dashboard Grafana agar lebih mudah dalam membacanya.
Untuk lab kali ini hal-hal yang akan kita lakukan yaitu:
1. Install Node Exporter di setiap VM/Instances
2. Install Prometheus disalah satu VM/Instances
3. Install dan configure Grafana
Pada lab ini kita masih menggunakan environtment dari lab yang sebelumnya, jadi untuk topologi yang digunakan masih sama. Install dan konfigurasi Prometheus dan Grafana dilakukan di VM rb-k8s-lb1
A. Install Node Exporter di setiap VM/Instances
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
tar xvfz node_exporter-1.3.1.linux-amd64.tar.gz
sudo nano ip-list.txt
10.60.60.43
10.60.60.44
10.60.60.51
10.60.60.52
10.60.60.53
10.60.60.54
10.60.60.55
10.60.60.56
sudo nano add-node-exporter.sh
sudo mv node_exporter /usr/local/bin/;
sudo mv node_exporter.service /etc/systemd/system/node_exporter.service;
sudo chmod 644 /etc/systemd/system/node_exporter.service;
sudo rm add-node-exporter.sh
sudo systemctl daemon-reload;
sudo systemctl enable node_exporter;
sudo systemctl start node_exporter;
sudo systemctl status node_exporter;
sudo nano node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
sudo nano transfer-node-exporter.sh
#!/bin/bash
for i in $(cat ip-list.txt)
do
echo "#### Execute On $i ####"
scp node_exporter node_exporter.service add-node-exporter.sh $i:~/
done
sudo chmod +x transfer-node-exporter.sh
sudo ./transfer-node-exporter.sh
sudo nano install-node-exporter.sh
#!/bin/bash
for i in $(cat ip-list.txt)
do
echo "#### Installing On $i ####"
ssh $i bash add-node-exporter.sh systemctl status node_exporter.service
done
sudo chmod +x install-node-exporter.sh
./install-node-exporter.sh
root@rb-k8s-lb1:~# sudo systemctl status node_exporter.service
● node_exporter.service - Node Exporter
Loaded: loaded (/etc/systemd/system/node_exporter.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-02 16:24:00 UTC; 1 months 6 days ago
Main PID: 2006 (node_exporter)
Tasks: 10 (limit: 4676)
Memory: 22.4M
CGroup: /system.slice/node_exporter.service
└─2006 /usr/local/bin/node_exporter
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=thermal_zone
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=time
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=timex
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=udp_queues
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=uname
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=vmstat
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=xfs
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.253Z caller=node_exporter.go:115 level=info collector=zfs
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.254Z caller=node_exporter.go:199 level=info msg="Listening on" address=:9100
Feb 02 16:24:00 rb-k8s-lb1 node_exporter[2006]: ts=2022-02-02T16:24:00.254Z caller=tls_config.go:195 level=info msg="TLS is disabled." http2=false
root@rb-k8s-lb1:~#
root@rb-k8s-lb1:~# curl localhost:9100 -k
No comments:
Post a Comment