Repository: ambari Updated Branches: refs/heads/trunk 9c29d8495 -> 4c8a42b83
AMBARI-17600. System boottime metric is not being collected by AMS. (swagle) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4c8a42b8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4c8a42b8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4c8a42b8 Branch: refs/heads/trunk Commit: 4c8a42b83a2abd19382d154838bb047f64694df3 Parents: 9c29d84 Author: Siddharth Wagle <[email protected]> Authored: Wed Jul 6 17:37:39 2016 -0700 Committer: Siddharth Wagle <[email protected]> Committed: Wed Jul 6 17:47:36 2016 -0700 ---------------------------------------------------------------------- .../src/main/python/core/host_info.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4c8a42b8/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 ccc1366..5e88412 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 @@ -53,6 +53,9 @@ class HostInfo(): """ cpu_times = psutil.cpu_times_percent() cpu_count = self.__host_static_info.get('cpu_num', 1) + # Since only boot time which is a part of static info is not sent with + # other payload sending it with cpu stats. + boot_time = self.__host_static_info.get('boot_time') result = { 'cpu_num': int(cpu_count), @@ -63,7 +66,8 @@ class HostInfo(): 'cpu_wio': cpu_times.iowait if hasattr(cpu_times, 'iowait') else 0, 'cpu_intr': cpu_times.irq if hasattr(cpu_times, 'irq') else 0, 'cpu_sintr': cpu_times.softirq if hasattr(cpu_times, 'softirq') else 0, - 'cpu_steal': cpu_times.steal if hasattr(cpu_times, 'steal') else 0 + 'cpu_steal': cpu_times.steal if hasattr(cpu_times, 'steal') else 0, + 'boot_time': long(boot_time) if boot_time else 0 } if platform.system() != "Windows": load_avg = os.getloadavg()
