Prometheus query to visualize "Cluster Node CPU Utilization" - many-to-many matching not allowed

51 views Asked by At

I am trying to query the Cluster Node CPU Utilization for my Kubernetes cluster using the prometheus. I am using the following query

sum by (kubernetes_node) (rate(node_cpu_seconds_total{mode!~"idle|wait|iowait"}[5m])) / on (kubernetes_node) label_join(machine_cpu_cores, "kubernetes_node", "", "kubernetes_io_hostname") * 100 > 80

But I get the following error:

Error executing query: found duplicate series for the match group {} on the right hand-side of the operation: [{name="machine_cpu_cores", boot_id="", endpoint="https-metrics", instance="", job="kubelet", machine_id="", metrics_path="/metrics/cadvisor", namespace="kube-system", node="aks-oi--vmss000002", service="-kube-prometheus-sta-kubelet", system_uuid=""}, {name="machine_cpu_cores", boot_id="", endpoint="https-metrics", instance="", job="kubelet", machine_id="", metrics_path="/metrics/cadvisor", namespace="kube-system", node="aks-defaultnp01--vmss000004", service="-kube-prometheus-sta-kubelet", system_uuid=""}];many-to-many matching not allowed: matching labels must be unique on one side

Could someone please help me with this? I am very new to prometheus queries and I greatly appreciate your help on this :)

Thank You!

0

There are 0 answers