1.服务器node执行,被监控端
docker run -d --name node-exporter --restart=always --net="host" --pid="host" -v "/:/host:ro,rslave" prom/node-exporter --path.rootfs=/host
docker run -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker/:/var/lib/docker:ro -p 28080:8080 --detach=true --privileged=true --name=cadvisor --restart=always google/cadvisor:latest
2.直接再现有prometheus上配置
或者在服务器执行下面命令搭建一个
docker run -d -p 9090:9090 --restart=always --name=prometheus -v /data/prom/prometheus/config:/etc/prometheus prom/prometheus --config.file=/etc/prometheus/prometheus.yml --web.enable-lifecycle
配置主机
global:
scrape_interval: 35s
evaluation_interval: 35s
alerting:
alertmanagers:
- static_configs:
- targets:
- alert.devops-test.mingyuanyun.com
- targets:
rule_files:
- "first_rules.yml"
- "second_rules.yml"
scrape_configs:
-
job_name: 'prometheus'
static_configs:- targets: ['localhost:9090']
-
job_name: 测试环境win
honor_timestamps: true
scrape_interval: 50s
scrape_timeout: 40s
metrics_path: /metrics
scheme: http
static_configs:- targets:
- xxxx:9182
- targets:
-
job_name: 测试环境linux
honor_timestamps: true
scrape_interval: 50s
scrape_timeout: 40s
metrics_path: /metrics
scheme: http
static_configs:- targets:
- 10.5.11.xxx:9100
- targets:
-
job_name: 测试环境容器
honor_timestamps: true
scrape_interval: 50s
scrape_timeout: 40s
metrics_path: /metrics
scheme: http
static_configs:- targets:
- 10.5.11.xxx:28080
- targets:
搭建一个模板
docker run -d --restart=always -p 3001:3000 --name grafana grafana/grafana
导入 8919