简体   繁体   English

Prometheus:减法标签匹配

[英]Prometheus: Label matching on substraction

I have the following Prometheus query and want the right side of my substraction to only subtract the container_memory_usage_bytes for each node on the left side of the substraction.我有以下 Prometheus 查询,并希望我的减法右侧只减去减法左侧每个节点的container_memory_usage_bytes

Query:询问:

sum(kube_node_status_capacity_memory_bytes) by (node) - on (instance) group_left container_memory_usage_bytes

The left side of the subtraction works.减法的左侧有效。

But for the whole query I get但对于整个查询,我得到

Error executing query: found duplicate series for the match group;many-to-many matching not allowed: matching labels must be unique on one side执行查询时出错:找到匹配组的重复系列;不允许多对多匹配:匹配标签在一侧必须是唯一的

How can I make my query to match exactly the labels node == instance from left to right side?如何使我的查询从左到右与标签节点 == 实例完全匹配?

The RHS has no instance label, so it's trying to match all those series to one on the LHS . RHS没有实例标签,因此它试图将所有这些系列与LHS上的一个相匹配。 You have to also add sum before listing container_memory_usage_bytes metric, - sum(container_memory_usage_bytes) .您还必须在列出container_memory_usage_bytes指标之前添加sum , - sum(container_memory_usage_bytes)

Please take a look here: prometheus-metrics .请看这里: prometheus-metrics

Useful article: label-proportions .有用的文章: 标签比例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在普罗米修斯度量标准中复制标签 - How replicate label in prometheus metric Prometheus 指标与 kubernetes 仪表板中的 kubestate 指标不匹配 - Prometheus metrics are not matching with kubestate metrics in kubernetes dashboard 标签替换普罗米修斯中的范围向量 - Label replace over a range vector in Prometheus 如何将kubernetes pods标签添加到prometheus指标? - How to add kubernetes pods label to prometheus metrics? 在 Prometheus 警报规则中获取部署 object label - Getting deployment object label in Prometheus alert rules 重新标记配置中的普罗米修斯多源标签 - Prometheus multiple source label in relabel config 在 Prometheus 中找出标签的不同值并设置警报 - Finding out distinct value for a label in Prometheus and setup an alert Prometheus CR 规范中的 ServiceMonitors 发现(标签选择器和命名空间选择器) - ServiceMonitors discovery (Label Selector and Namespace Selector) in Prometheus CR specification 在刮板中为 cAdvisor 更改 Prometheus 作业标签会破坏 Grafana 仪表板 - Changing Prometheus job label in scraper for cAdvisor breaks Grafana dashboards 如果 pod 未声明容器端口,则无法重新标记 Prometheus pod scrape label __address__ - Unable to relabel Prometheus pod scrape label __address__ if pod doesn't declare containerport
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM