You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The kubernetes.container.cpu.usage.node.pct and kubernetes.container.memory.usage.node.pct are supposed to report the node allocatable usage percentages, however they actually report node capacity percentages.
}
switch r := r.(type) {
case *kubernetes.Pod:
return map[string]mapstr.M{id: specificMetaGen.Generate(r)}
case *kubernetes.Node:
nodeName := r.GetObjectMeta().GetName()
metrics := NewNodeMetrics()
if cpu, ok := r.Status.Capacity["cpu"]; ok {
if q, err := resource.ParseQuantity(cpu.String()); err == nil {
metrics.CoresAllocatable = NewFloat64Metric(float64(q.MilliValue()) / 1000)
}
}
if memory, ok := r.Status.Capacity["memory"]; ok {
if q, err := resource.ParseQuantity(memory.String()); err == nil {
metrics.MemoryAllocatable = NewFloat64Metric(float64(q.Value()))
}
}
nodeStore, _ := metricsRepo.AddNodeStore(nodeName)
Indeed changing the the code from "Capacity" to "Allocatable" in the line above fixes the problem. I notice the Memory usage calculation is also likewise incorrect on line 632 of the above source.
According to the docs here:
https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-kubernetes.html
The kubernetes.container.cpu.usage.node.pct and kubernetes.container.memory.usage.node.pct are supposed to report the node allocatable usage percentages, however they actually report node capacity percentages.
The relevant code is here:
beats/metricbeat/module/kubernetes/util/kubernetes.go
Line 627 in c773028
<Snip inline below?
Indeed changing the the code from "Capacity" to "Allocatable" in the line above fixes the problem. I notice the Memory usage calculation is also likewise incorrect on line 632 of the above source.
Can this be fixed please?
Thanks,
Kevin
For confirmed bugs, please report:
8.11.1 metricbeat container image.
Linux
https://discuss.elastic.co/t/kubernetes-container-cpu-usage-node-pct-reports-capacity-rather-than-documented-allocatable-usage/360962/1
Run metricbeat container with the kubernetes cpu metricset enabled.
The text was updated successfully, but these errors were encountered: