Repository: ambari
Updated Branches:
  refs/heads/branch-metrics-dev 063335855 -> 3b877ac82


AMBARI-5707. Fix for load average nulls.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b877ac8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b877ac8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b877ac8

Branch: refs/heads/branch-metrics-dev
Commit: 3b877ac820c8bca8a2b10f4bd31c99c7aa9089df
Parents: 0633358
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Fri Nov 21 14:19:31 2014 -0800
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Fri Nov 21 14:19:31 2014 -0800

----------------------------------------------------------------------
 .../src/main/python/core/host_info.py                          | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b877ac8/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
 
b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
index 7ca11b6..6d47485 100644
--- 
a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
+++ 
b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
@@ -52,9 +52,9 @@ class HostInfo():
       'cpu_wio' : cpu_times.iowait if hasattr(cpu_times, 'iowait') else '',
       'cpu_intr' : cpu_times.irq if hasattr(cpu_times, 'irq') else '',
       'cpu_sintr' : cpu_times.softirq if hasattr(cpu_times, 'softirq') else '',
-      'load_one' : load_avg[0] if hasattr(cpu_times, 'load_avg') else '',
-      'load_five' : load_avg[1] if hasattr(cpu_times, 'load_avg') else '',
-      'load_fifteen' : load_avg[2] if hasattr(cpu_times, 'load_avg') else ''
+      'load_one' : load_avg[0] if len(load_avg) > 0 else '',
+      'load_five' : load_avg[1] if len(load_avg) > 1 else '',
+      'load_fifteen' : load_avg[2] if len(load_avg) > 2 else ''
     }
   pass
 

Reply via email to