prometheus 通讯流程

prometheus 是主动从网关 pull 消息的,所以要先装下 push 网关这个东西

安装 prometheus

docker run --name prometheus -d  -p 0.0.0.0:9090:9090 -v /PATH/prometheus.yml:/etc/prometheus/prometheus.yml   quay.io/prometheus/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
~

安装 prometheus-gateaway

docker run -d -p 9091:9091 prom/pushgateway