How to collect cpu stats for elastic nodes


(Korhan Herguner) #1

Hi everyone,
I'd like to gather cpu level with rest api for any nodes. I am using the method on this page.
if my request type
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.
.
/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
Best regards.


(Shaunak Kashyap) #2

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


(Korhan Herguner) #3

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
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?