Pushgateway

部署 Pushgateway

cd /tmp

wget https://github.com/prometheus/pushgateway/releases/download/v1.9.0/pushgateway-1.9.0.linux-amd64.tar.gz

tar xf pushgateway-1.9.0.linux-amd64.tar.gz -C /usr/local

cd /usr/local

ln -s pushgateway-1.9.0.linux-amd64 pushgateway

# 启动 pushgateway
nohup /usr/local/pushgateway/pushgateway &>> pushgateway.log &

修改 Prometheus 配置文件

# vim prometheus.yml
# 路径:/usr/local/prometheus/prometheus.yml

# 在 scrape_configs 下新增 job_name
scrape_configs:
  - job_name: 'pushgateway'
    static_configs:
    - targets: ['192.168.31.23:9091']

重新加载配置

访问 metrics

测试脚本推送

可将脚本设置为定时任务(分钟级)或者死循环(秒级),即可实现定时推送监控指标

查看

浏览器查看

命令行查看

Last updated