【问题标题】:Promql queries for federated servers联合服务器的 Promql 查询
【发布时间】:2019-09-23 12:20:03
【问题描述】:

利用 prometheus federation 进行 Kubernetes 监控。

尝试为多个集群更改此 promql 查询:

计数

by(node) (sum by(node, cpu) (node_cpu_seconds_total{job="node-exporter"}
  * on(namespace, pod) group_left(node) node_namespace_pod:kube_pod_info:))
For multiple clusters, the query is giving:
Error executing query: found duplicate series for the match group {namespace="monitoring", pod="prometheus-k8s-1"} on the right hand-side of the operation: [{__name__="node_namespace_pod:kube_pod_info:", clustername="xyz", environment="dev", job="prometheus", location="haha", namespace="monitoring", node="228d5f45-27cc-4a59-b99d-3bab9ebe3b52", pod="prometheus-k8s-1", prometheus="monitoring/k8s", prometheus_replica="prometheus-k8s-0"}, {__name__="node_namespace_pod:kube_pod_info:", clustername="abc", environment="dev", job="prometheus", location="haha", namespace="monitoring", node="3faf3dfa-f8ab-4b3f-bda7-6662c1aa2a34", pod="prometheus-k8s-1", prometheus="monitoring/k8s", prometheus_replica="prometheus-k8s-1"}];many-to-many matching not allowed: matching labels must be unique on one side

添加 clustername 作为 prometheus 服务器的外部标签..

你能指导我吗?

【问题讨论】:

    标签: prometheus prometheus-operator


    【解决方案1】:

    由于 prometheus pod 作为 statefulset 运行而出现重复错误。 Pod 名称是 prometheus-k8s-1,它不会改变。

    您可能需要在 on(namespace, pod) 中使用其他一些参数,例如 uid 或其他在任何情况下都是唯一的。

    【讨论】:

      猜你喜欢
      • 2021-01-24
      • 1970-01-01
      • 2015-11-28
      • 1970-01-01
      • 2020-10-29
      • 2022-12-10
      • 2021-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多