# Metricbeat CPU usage total

**URL:** <https://discuss.elastic.co/t/metricbeat-cpu-usage-total/84260>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 2, 2017, 12:52pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-usage-total/84260 "2017-05-02T12:52:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GogLlundain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gogllundain/32/15620_2.png) [@GogLlundain](https://discuss.elastic.co/u/GogLlundain)\
**Post date:** [May 2, 2017, 12:52pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-usage-total/84260/1 "2017-05-02T12:52:28Z")

</div>

Hiya,

Metricbeat is working nicely for me but what I want to see for my servers are how busy they are.  
I get the CPU usage in parts (user, system, steal etc) and the idle %, what I want is the total usage as a percentage; the opposite of the idle percent value.

I expect the answer might be a TimeLion based one but I can't get that to work. Is there a really good TimeLion tutorial out there?

My solution in the end was to use logstash and a bit of ruby in the filter section like this:

```
if [@metadata][type] == "metricsets" {
    if [system][cpu][idle][pct] {
        ruby {
            code => "event.set('[system][cpu][busy][pct]', 1 - event.get('[system][cpu][idle][pct]'));"
        }
    }
}

```

Anything wrong with that, is there a better way to do this?

Thanks,  
Gog

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 3, 2017, 2:41pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-usage-total/84260/2 "2017-05-03T14:41:25Z")

</div>

Perhaps I miss something but I think as your calculation is quite simple you could use Kibana script fields for that: [https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

---

<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 31, 2017, 2:44pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-usage-total/84260/3 "2017-05-31T14:44:47Z")

</div>

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