# Elasticsearch and metricbeat - getting graf for Kubernetes Container CPU usage

**URL:** <https://discuss.elastic.co/t/elasticsearch-and-metricbeat-getting-graf-for-kubernetes-container-cpu-usage/126058>\
**Category:** Elasticsearch\
**Created:** [March 29, 2018, 9:03am UTC](https://discuss.elastic.co/t/elasticsearch-and-metricbeat-getting-graf-for-kubernetes-container-cpu-usage/126058 "2018-03-29T09:03:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita\_Krasnov](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@Nikita\_Krasnov](https://discuss.elastic.co/u/Nikita_Krasnov)\
**Post date:** [March 29, 2018, 9:03am UTC](https://discuss.elastic.co/t/elasticsearch-and-metricbeat-getting-graf-for-kubernetes-container-cpu-usage/126058/1 "2018-03-29T09:03:02Z")

</div>

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](https://discuss.elastic.co/t/convert-nanocore-to-percentage/116538) 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:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fbade540f7367c9278884d86973c98832cb0fe4d.png)  
What I am doing wrong?

---

<div class="post-metadata">

**Author:** ![kanthimathi](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@kanthimathi](https://discuss.elastic.co/u/kanthimathi)\
**Post date:** [April 4, 2018, 3:46am UTC](https://discuss.elastic.co/t/elasticsearch-and-metricbeat-getting-graf-for-kubernetes-container-cpu-usage/126058/2 "2018-04-04T03:46:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 2, 2018, 3:46am UTC](https://discuss.elastic.co/t/elasticsearch-and-metricbeat-getting-graf-for-kubernetes-container-cpu-usage/126058/3 "2018-05-02T03:46:23Z")

</div>

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