prometheus 是主动从网关 pull 消息的,所以要先装下 push 网关这个东西
docker run --name prometheus -d -p 0.0.0.0:9090:9090 -v /PATH/prometheus.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus
# vim prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "push-metrics"
static_configs:
- targets: ["你的IP:9091"]
honor_labels: true
~
docker run -d -p 9091:9091 prom/pushgateway