# How to collect cpu stats for elastic nodes

**URL:** <https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165>\
**Category:** Elasticsearch\
**Created:** [February 13, 2019, 8:17am UTC](https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165 "2019-02-13T08:17:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)\
**Post date:** [February 13, 2019, 8:17am UTC](https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165/1 "2019-02-13T08:17:47Z")

</div>

Hi everyone,  
I'd like to gather cpu level with rest api for any nodes. I am using the method [on this page](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html).  
**if my request type**  
[http://localhost:9200/\_nodes/172.28](http://localhost:9200/_nodes/172.28)._._/stats/os  
**Response**  
{  
"\_nodes" : {  
"total" : 1,  
"successful" : 1,  
"failed" : 0  
},  
"cluster\_name" : "Master169",  
"nodes" : {  
"f42pBKbpQ3-XodDyh8Z-yw" : {  
"timestamp" : 1550044795008,  
"name" : "**",  
"transport\_address" : "**",  
"host" : "\*\*\*",  
"ip" : "\*_",  
"roles" : [  
"master",  
"data",  
"ingest"  
],  
"attributes" : {  
"ml.machine\_memory" : "25757966336",  
"xpack.installed" : "true",  
"ml.max\_open\_jobs" : "20",  
"ml.enabled" : "true"  
},  
"os" : {  
"timestamp" : 1550044795008,  
"cpu" : {  
"percent" : 1  
},  
"mem" : {  
"total\_in\_bytes" : 25757966336,  
"free\_in\_bytes" : 14517907456,  
"used\_in\_bytes" : 11240058880,  
"free\_percent" : 56,  
"used\_percent" : 44  
},  
"swap" : {  
"total\_in\_bytes" : 29516062720,  
"free\_in\_bytes" : 17683697664,  
"used\_in\_bytes" : 11832365056  
}  
}  
}  
}  
}  
but How can ı collector only cpu percent  
 **REQUEST**  
 [http://localhost:9200/\_nodes/172.28](http://localhost:9200/_nodes/172.28).._/stats/os/cpu/percent **_but no response_**

I want to response only return cpu information  
"os" : {  
"timestamp" : 1550044795008,  
"cpu" : {  
"percent" : 1  
},

The finally  
I'd like to os.cpu.load\_average.1m below write http query [http://localhost:9200/\_nodes/stats/os/cpu/load/average/1m](http://localhost:9200/_nodes/stats/os/cpu/load/average/1m)  
Best regards.

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [February 14, 2019, 4:12pm UTC](https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165/2 "2019-02-14T16:12:29Z")

</div>

Take a look at [https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#common-options-response-filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#common-options-response-filtering).

---

<div class="post-metadata">

**Author:** ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)\
**Post date:** [February 14, 2019, 5:43pm UTC](https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165/3 "2019-02-14T17:43:58Z")

</div>

Hi Shaunak,  
Firstly, Thank you for response. I have two question. Can you help me this problem about?  
**First problem for me;**  
I use demo elastic [web page](https://demo.elastic.co/app/kibana#/home?_g=(refreshInterval:(pause:!f,value:5000),time:(from:now-15m,mode:quick,to:now)))  
I read that you send resource page but ı don't understand and I write example query  
**GET \_nodes/stats/os?filter\_path=cpu** but not response How can ı fix it?

**second problem**  
My local system is enable system metric but Cpu 1m, 5m and 15 m is not loading. This resouce demo stats "os" : {  
"timestamp" : 1550166018562,  
"cpu" : {  
"percent" : 9,  
"load\_average" : {  
"1m" : 3.12,  
"5m" : 3.14,  
"15m" : 3.33  
}  
},  
After that my local resource  
os" : {  
"timestamp" : 1550044795008,  
"cpu" : {  
"percent" : 1  
} .  
What do ı need to do to see the average load of CPU?

---

<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:** [March 14, 2019, 5:44pm UTC](https://discuss.elastic.co/t/how-to-collect-cpu-stats-for-elastic-nodes/168165/4 "2019-03-14T17:44:06Z")

</div>

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