Elasticsearch and metricbeat - getting graf for Kubernetes Container CPU usage

Hello to everyone!
I use ElasticSearch 6x, MetricBeat 6.2.3 and Grafana 5x
I want to display the graf for Kubernetes Container CPU usage in percents.
There are such fields in metricbeat: kubernetes.container.cpu.usage.nanocore and kubernetes.container.cpu.limit.nanocores. But they are measured in nanocores.
According to this link: Convert nanocore to percentage I sholud do such steps: kubernetes.container.cpu.usage.nanocore/kubernetes.container.cpu.limit.nanocores*100 to getting the percentage. I use formula in metric script (_value/doc['kubernetes.container.cpu.limit.nanocores'].value)*100 where _value is kubernetes.container.cpu.usage.nanocore.
After all of it I get strange graph:

What I am doing wrong?

I am not sure about the output or parameters you use in grafana. I used to kibana so in that case you can find the below image for what I did in the link you attached. That involved painless scripting language. Though I didn't get the output as expected. In case of kibana, they messaged as they are working on getting percentage directly in the visualisations itself.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.