From e837d4f082d32a69bd345ba805ee1d96b8981296 Mon Sep 17 00:00:00 2001 From: Dmytro Sen Date: Mon, 14 Sep 2015 13:08:43 +0300 Subject: AMBARI-13024 Disable MetricsDataTransferMethodFactory for AMS (dsen) --- .../src/main/python/core/host_info.py | 16 ++++++++-------- .../src/test/python/core/TestHostInfo.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ambari-metrics') 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 e0ed8e774f..60e92940c6 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 @@ -57,14 +57,14 @@ class HostInfo(): result = { 'cpu_num': int(cpu_count), - 'cpu_user': cpu_times.user*100 if hasattr(cpu_times, 'user') else 0, - 'cpu_system': cpu_times.system*100 if hasattr(cpu_times, 'system') else 0, - 'cpu_idle': cpu_times.idle*100 if hasattr(cpu_times, 'idle') else 0, - 'cpu_nice': cpu_times.nice*100 if hasattr(cpu_times, 'nice') else 0, - 'cpu_wio': cpu_times.iowait*100 if hasattr(cpu_times, 'iowait') else 0, - 'cpu_intr': cpu_times.irq*100 if hasattr(cpu_times, 'irq') else 0, - 'cpu_sintr': cpu_times.softirq*100 if hasattr(cpu_times, 'softirq') else 0, - 'cpu_steal': cpu_times.steal*100 if hasattr(cpu_times, 'steal') else 0 + 'cpu_user': cpu_times.user if hasattr(cpu_times, 'user') else 0, + 'cpu_system': cpu_times.system if hasattr(cpu_times, 'system') else 0, + 'cpu_idle': cpu_times.idle if hasattr(cpu_times, 'idle') else 0, + 'cpu_nice': cpu_times.nice if hasattr(cpu_times, 'nice') else 0, + '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 } if platform.system() != "Windows": load_avg = os.getloadavg() diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestHostInfo.py b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestHostInfo.py index bdedc2e6eb..f07b5739ae 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestHostInfo.py +++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestHostInfo.py @@ -54,10 +54,10 @@ class TestHostInfo(TestCase): else: cpu = hostinfo.get_cpu_times() - self.assertAlmostEqual(cpu['cpu_user'], 10) - self.assertAlmostEqual(cpu['cpu_system'], 10) - self.assertAlmostEqual(cpu['cpu_idle'], 70) - self.assertAlmostEqual(cpu['cpu_nice'], 10) + self.assertAlmostEqual(cpu['cpu_user'], 0.1) + self.assertAlmostEqual(cpu['cpu_system'], 0.1) + self.assertAlmostEqual(cpu['cpu_idle'], 0.7) + self.assertAlmostEqual(cpu['cpu_nice'], 0.1) self.assertAlmostEqual(cpu['cpu_wio'], 0) self.assertAlmostEqual(cpu['cpu_intr'], 0) self.assertAlmostEqual(cpu['cpu_sintr'], 0) -- cgit v1.2.3