grafanaを導入するぞ
Dockerでやる
node_exporterを入れる
node_exporter のreleaseからバイナリを落としてきて /usr/local/bin/node_exporter に置く。 /etc/systemd/system/node_exporter.service
code:node_exporter.service
ExecStart=/usr/local/bin/node_exporter
Restart=always
User=nobody
WantedBy=multi-user.target
まずprometheus
code:docker-compose.yml
version: '3'
services:
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- 9090:9090
command:
- '--config.file=/etc/prometheus/prometheus.yml'
volumes:
prometheus_data:
code:prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
https://scrapbox.io/files/67307b60c144a5e2578c2256.png
つぎはgrafanaやる
docker compose を変える
code:docker-compose.yml
version: '3'
services:
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- 9090:9090
command:
- '--config.file=/etc/prometheus/prometheus.yml'
grafana:
image: grafana/grafana
ports:
- "3000:3000"
volumes:
prometheus_data:
ソースを追加する
https://scrapbox.io/files/67307c81d5e96e3e96113238.png
node_exporterのテンプレートを使う
テンプレートID: 1860
できたもの
https://scrapbox.io/files/67316ca969bf98ac610d26b3.png