首先使用docker拉取镜像包
docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
启动node-exporter
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
prom/node-exporter
访问url验证是否启动成功:
http://192.168.200.104:9100/metrics
启动prometheus
新建目录prometheus,编辑配置文件prometheus.yml
mkdir /opt/prometheus
cd /opt/prometheus/
vim prometheus.yml
global:
scrape_interval: 60s
evaluation_interval: 60s
scrape_configs:
- job_name: prometheus
static_configs:
- tar