Monitoring Prometheus dengan Grafana

  1. Node monitoring: node-monitoring (ip: 10.67.67.30, OS: Centos 7)
  2. Node container: node-container (ip: 10.67.67.31, OS: Centos 7)

Lakukan pada node container

# firewall-cmd --zone=public --permanent --add-port=9100/tcp
# firewall-cmd --reload
# cd /opt
# wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
# tar xvfz node_exporter-0.18.1.linux-amd64.tar.gz
# ./node_exporter --help
# ./node_exporter
...
INFO[0000] - netstat source="node_exporter.go:104"
INFO[0000] - nfs source="node_exporter.go:104"
INFO[0000] - nfsd source="node_exporter.go:104"
INFO[0000] - pressure source="node_exporter.go:104"
INFO[0000] - sockstat source="node_exporter.go:104"
INFO[0000] - stat source="node_exporter.go:104"
INFO[0000] - textfile source="node_exporter.go:104"
INFO[0000] - time source="node_exporter.go:104"
INFO[0000] - timex source="node_exporter.go:104"
INFO[0000] - uname source="node_exporter.go:104"
INFO[0000] - vmstat source="node_exporter.go:104"
INFO[0000] - xfs source="node_exporter.go:104"
INFO[0000] - zfs source="node_exporter.go:104"
INFO[0000] Listening on :9100 source="node_exporter.go:170"
access metriks exporter node-container
# vi /etc/systemd/system/node_exporter.service

[Unit]
Description=Node Exporter

[Service]
User=root
ExecStart=/opt/node_exporter-0.18.1.linux-amd64/node_exporter

[Install]
WantedBy=default.target
# systemctl daemon-reload
# systemctl enable node_exporter.service
# systemctl start node_exporter.service
# systemctl status node_exporter.service
# journalctl -u node_exporter

Instalasi Prometheus

# firewall-cmd --zone=public --permanent --add-port=9090/tcp
# firewall-cmd --reload
# cd /opt
# wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
# tar xvfz prometheus-2.10.0.linux-amd64.tar.gz
# cd prometheus-2.10.0.linux-amd64
# vi config.yml

global:
scrape_interval: 15s
evaluation_interval: 15s

scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['10.67.67.30:9090']
- job_name: 'node'
static_configs:
- targets: ['10.67.67.31:9100']
# ./promtool check config config.yml
# ./prometheus --web.listen-address 10.X0.X0.21:9090 --config.file /opt/prometheus-2.10.0.linux-amd64/config.yml
# vi /etc/systemd/system/prometheus_server.service

[Unit]
Description=Prometheus Server

[Service]
User=root
ExecStart=/opt/prometheus-2.10.0.linux-amd64/prometheus --web.listen-address 10.X0.X0.21:9090 --config.file /opt/prometheus-2.10.0.linux-amd64/config.yml

[Install]
WantedBy=default.target
# systemctl daemon-reload
# systemctl enable prometheus_server.service
# systemctl start prometheus_server.service
# systemctl status prometheus_server.service
# journalctl -u prometheus_server
prometheus target

Install Grafana di node-monitoring

# firewall-cmd --zone=public --permanent --add-port=3000/tcp
# firewall-cmd --reload
# cd /opt
# wget https://dl.grafana.com/oss/release/grafana-6.2.5.linux-amd64.tar.gz
# tar -zxvf grafana-6.2.5.linux-amd64.tar.gz
# cd grafana-6.2.5
# ./bin/grafana-server -homepath /opt/grafana-6.2.5 web
# vi /etc/systemd/system/grafana.service

[Unit]
Description=Grafana

[Service]
User=root
ExecStart=/opt/grafana-6.2.5/bin/grafana-server -homepath /opt/grafana-6.2.5/ web

[Install]
WantedBy=default.target
# systemctl daemon-reload
# systemctl enable grafana.service
# systemctl start grafana.service
# systemctl status grafana.service
# journalctl -u grafana
username : admin
password : admin
akses dashboard grafana

Contoh:

--

--

Cloud DevOps Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store