docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
启动node-exporter
docker run -d -p 9100:9100 --name node-exporter --restart=always -v /opt/dockerData/node-exporter/proc:/host/proc:ro -v /opt/dockerData/node-exporter/sys:/host/sys:ro -v /opt/dockerData/node-exporter:/rootfs:ro prom/node-exporter
启动promethus
docker run -d --name prometheus --restart=always -u root -p 9090:9090 -v /opt/dockerData/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /opt/dockerData/prometheus:/prometheus -v /opt/dockerData/prometheus/conf:/etc/prometheus/conf prom/prometheus
prometheus.yml
global:
scrape_interval: 60s
evaluation_interval: 60s
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- 192.168.0.104:9090
- job_name: node-exporter
static_configs:
- targets:
- 192.168.0.104:9100
启动grafana
docker run -d -p 3000:3000 --restart=always --name=grafana -u root -v /opt/dockerData/grafana:/var/lib/grafana grafana/grafana
默认用户名和密码均为admin,登录成功后修改默认密码
基于docker 搭建Prometheus+Grafana的过程详解
原文:https://www.cnblogs.com/zepc007/p/14644690.html