多client向同一个pushgateway推送指标被覆盖问题

问题:

多个client向同一个pushgateway推送指标,每个client推送的指标名称相同但是lable不同。如下:

bash 复制代码
# TYPE ObjectCount gauge
ObjectCount{server_id="server1"} 4
ObjectCount{server_id="server2"} 4
ObjectCount{server_id="server3"} 0

推送地址如下:

bash 复制代码
http://192.168.0.1/metrics/job/test

结果从pushgateway处只能查询其中一个client推送的指标,推测时发生了覆盖。

原因:

根据官方文档描述

Pushed metrics are managed in groups, identified by a grouping key of any number of labels, of which the first must be the job label.

grouping key是这些metrics的唯一标识,grouping key实际上就是若干个label的组合。

也就是说上述指标都推送到http://192.168.0.1/metrics/job/test,会被pushgateway认为是同一组指标的多次推送,所以发生了覆盖。

解决:

每个client需要推送到独立的url上,即每个client的grouping key需要不一样。例如三个client的推送URL改为:

bash 复制代码
http://192.168.0.1/metrics/job/test/server_id/server1

http://192.168.0.1/metrics/job/test/server_id/server2

http://192.168.0.1/metrics/job/test/server_id/server3

问题便可迎刃而解

参考:

解决pushgateway数据多次推送会覆盖的问题_pushgateway 数据覆盖-CSDN博客

the same metric with different labels override each other · Issue #65 · prometheus/pushgateway · GitHub

GitHub - prometheus/pushgateway: Push acceptor for ephemeral and batch jobs.

相关推荐
码上淘金1 天前
【Prometheus 】通过 Pushgateway 上报指标数据
prometheus
JAVA拾贝3 天前
Prometheus+Grafana运维监控并实现钉钉告警
运维·钉钉·grafana·prometheus·运维监控
TDengine (老段)16 天前
使用 Prometheus 访问 TDengine ---
大数据·数据库·prometheus·时序数据库·iot·tdengine·涛思数据
枫桥听月16 天前
16.大数据监控
大数据·prometheus
广目软件16 天前
GM DC Monitor v2.0 卸载教程
服务器·网络·zabbix·prometheus
不太聪明的样子17 天前
c++ 项目使用 prometheus + grafana 进行实时监控
c++·grafana·prometheus
南夏一木子23 天前
性能测试——搭建Prometheus+Grafana平台
grafana·prometheus
奈斯ing23 天前
【prometheus+Grafana篇】基于Prometheus+Grafana实现postgreSQL数据库的监控与可视化
运维·数据库·信息可视化·grafana·prometheus
xixingzhe224 天前
docker compose安装Prometheus、Grafana
docker·grafana·prometheus
碧水澜庭1 个月前
Prometheus+ Grafana 监控系统入门
grafana·prometheus