mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3383: Fetch CPU utilization more reliable.
This should fix that we can't gather CPU statistics on hypervisors
> Ubuntu 12.04
(cherry picked from commit 69ee01af9d)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Conflicts:
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
This commit is contained in:
parent
56d8b173a0
commit
5cd0d25812
|
|
@ -3120,8 +3120,7 @@ ServerResource {
|
|||
private Answer execute(GetHostStatsCommand cmd) {
|
||||
final Script cpuScript = new Script("/bin/bash", s_logger);
|
||||
cpuScript.add("-c");
|
||||
cpuScript
|
||||
.add("idle=$(top -b -n 1|grep Cpu\\(s\\):|cut -d% -f4|cut -d, -f2);echo $idle");
|
||||
cpuScript.add("idle=$(top -b -n 1| awk -F, '/^[%]*[Cc]pu/{$0=$4; gsub(/[^0-9.,]+/,\"\"); print }'); echo $idle");
|
||||
|
||||
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
|
||||
String result = cpuScript.execute(parser);
|
||||
|
|
|
|||
Loading…
Reference in New Issue