pushgateway

pushgateway

采用被动推送的方式,需要自定义监控脚本,把需要监控的数据主动推给pushgateway的api,然后pushgateway等待普罗米修斯抓取数据
默认数据存储在内存中
普罗米修斯配置pushgateway与普通exporter一样

image-20230805195154920

github: https://github.com/prometheus/pushgateway

端口: 9091

安装:

wget https://github.com/prometheus/pushgateway/releases/download/v1.6.0/pushgateway-1.6.0.linux-amd64.tar.gz
tar xf pushgateway-1.6.0.linux-amd64.tar.gz
mv pushgateway-1.6.0.linux-amd64/pushgateway /bin/

pushgateway --web.enable-lifecycle --web.enable-admin-api --persistence.file="" --persistence.interval=5m

上传/删除数据:

#通过pushgateway的api添加指标数据,job名称是必须写
http://ip:9091/metrics/job/job名称{/标签名/标签值}

echo "test_name 200" | curl --data-binary @- 2.2.2.15:9091/metrics/job/test_name
cat <<eof |curl --data-binary @- 2.2.2.15:9091/metrics/job/test_job/instance/2.2.2.15
#one
node_one 1
#two
node_two 2
eof

curl -X DELETE 2.2.2.15:9091/metrics/job/test_job/instance/2.2.2.15
posted @ 2023-11-06 18:10  suyanhj  阅读(66)  评论(0)    收藏  举报