1.安装pushgateway

1.上传pushgateway而二进制包并解压
tar xf pushgateway-1.0.0.linux-amd64.tar.gz
2.改名
mv pushgateway-1.0.0 pushgateway
3.启动
nohup ./pushgateway &

2.修改promethues服务端配置

vim prometheus.yml
  - job_name: 'pushgateway'
    static_configs:
      - targets: ['10.10.9.200:9091']
        labels:
          instance: dream
增加配置,重启prometheus
页面访问pushgateway:10.10.9.200:9091

3.如何自定义监控,并传递数据

1.把node_exporter数据穿给pushgateway
curl 127.0.0.1:9100/metrics|curl --data-binary @- http://10.10.9.200:9091/metrics/job/test/instance/10.10.9.200
2.自定义监控项值
curl "test 5"|curl --data-binary @- http://10.10.9.200:9091/metrics/job/test/instance/10.10.9.200

传递后可以在pushgateway页面查看,也可以在promethues页面查询

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐