- 安装pushgateway
下载 pushgateway-1.2.0.linux-amd64.tar.gz 解压缩到指定目录
下载地址 https://github.com/prometheus/pushgateway/releases
tar xzvf pushgateway-1.2.0.linux-amd64.tar.gz
mv pushgateway-1.2.0.linux-amd64 /usr/local/pushgateway
- 后台运行 pushgateway
nohup ./pushgateway > run.log 2>&1 &
- 查看
curl localhost:9091/metrics #访问 pushgateway-server:9091/metrics可以看到指标
- 配置prometheus.yml 后重载prometheus
- job_name: pushgateway
honor_labels: true
static_configs:
- targets: ['192.168.x.xxx:9091']
labels:
instance: pushgateway
service: pushgatewayservice
pushgateway默认端口9091
- 查看是否成功连接 Prometheus
可以通过Prometheus Web端查看 http://192.168.x.xxx:9090/targets 中是否有设置的 pushgateway 的metrics。