1. 拉取依赖镜像
docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
2.分别启动各镜像
-
启动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 - job_name: jenkins scheme: http metrics_path: prometheus bearer_token: bearer_token static_configs: - targets: - 192.168.57.242:8080
-
启动grafana
docker run -d -p 3000:3000 --restart=always --name=grafana -u root -v /opt/dockerData/grafana:/var/lib/grafana grafana/grafana
3.登录grafana
默认用户名和密码均为admin,登录成功后修改默认密码