ElasticHQ / elasticsearch-HQ

Monitoring and Management Web Application for ElasticSearch instances and clusters.
http://www.elastichq.org
Other
4.96k stars 531 forks source link

CPU usage not displayed #456

Closed Starwalker2000 closed 5 years ago

Starwalker2000 commented 5 years ago

General information

Issue Description

The _nodes/stats API of ES 6.2.2 returns CPU percent and load_average like following:

{ "nodes": { "xxx": { "os": { "cpu": { "percent": 64, "load_average": { "1m": 7.25, "5m": 6.62, "15m": 6.46 } } } } } }

But in Task.py, os.load_average and os.cpu_percent are used to get the two metrics. Should be os.cpu.percent and os.cpu.load_average.XXX.

Source Code / Logs

Now:

"os_load_average": jmespath.search("os.load_average", node_dict), "os_cpu_percent": jmespath.search("os.cpu_percent", node_dict),

One possible solution:

"os_load_average": jmespath.search("os.load_average", node_dict) if jmespath.search("os.load_average", node_dict) is not None else jmespath.search("os.cpu.load_average.\"1m\"", node_dict), "os_cpu_percent": jmespath.search("os.cpu_percent", node_dict) if jmespath.search("os.cpu_percent", node_dict) is not None else jmespath.search("os.cpu.percent", node_dict),

royrusso commented 5 years ago

I would not doubt the geniuses at Elastic making backward incompatible changes. I'll have a look and fix for next release.

STamil commented 5 years ago

Hi, I am also facing this issue could you please fixed the same.