summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmytro Sen <dsen@apache.org>2015-09-14 13:08:43 +0300
committerDmytro Sen <dsen@apache.org>2015-09-14 13:08:43 +0300
commite837d4f082d32a69bd345ba805ee1d96b8981296 (patch)
treed2f55a74cba6d39db4d9eaf91a6dc16d1f50e9eb
parent63dded51d90d06f1ca7e55e6b756a5343c22659e (diff)
AMBARI-13024 Disable MetricsDataTransferMethodFactory for AMS (dsen)
-rw-r--r--ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py16
-rw-r--r--ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestHostInfo.py8
-rw-r--r--ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java2
-rw-r--r--ambari-server/src/test/resources/ams/multiple_host_metrics.json224
-rw-r--r--ambari-server/src/test/resources/ams/single_host_metric.json224
5 files changed, 237 insertions, 237 deletions
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)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
index 9d7015855b..5850ede830 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDataTransferMethodFactory.java
@@ -66,7 +66,7 @@ class PercentageAdjustmentTransferMethod extends MetricsDataTransferMethod {
@Override
public Double getData(Double data) {
- return new Double(data / 100);
+ return data < 100 ? data : data / 100 ;
}
}
diff --git a/ambari-server/src/test/resources/ams/multiple_host_metrics.json b/ambari-server/src/test/resources/ams/multiple_host_metrics.json
index 031e7771b5..f42f9daaed 100644
--- a/ambari-server/src/test/resources/ams/multiple_host_metrics.json
+++ b/ambari-server/src/test/resources/ams/multiple_host_metrics.json
@@ -6,118 +6,118 @@
"hostname":"h1",
"starttime": 1416445244801,
"metrics": {
- "1416445244801": 4006.085,
- "1416445259801": 4006.29,
- "1416445274801": 4006.6475,
- "1416445289801": 4006.9474999999998,
- "1416445304801": 4007.1025,
- "1416445319801": 4007.21,
- "1416445364801": 4007.8375,
- "1416445379801": 4008.0425000000005,
- "1416445394801": 4008.37,
- "1416445409801": 4008.9474999999998,
- "1416445424801": 4009.08,
- "1416445439801": 4009.185,
- "1416445484801": 4009.9525,
- "1416445499801": 4010.19,
- "1416445514801": 4010.8725,
- "1416445529801": 4011.3424999999997,
- "1416445544801": 4011.4975000000004,
- "1416445559801": 4011.665,
- "1416445604801": 4012.57,
- "1416445619801": 4012.9325,
- "1416445634801": 4013.3424999999997,
- "1416445649801": 4013.9225,
- "1416445664801": 4014.1949999999997,
- "1416445679801": 4014.58,
- "1416445724801": 4015.73,
- "1416445739801": 4015.8599999999997,
- "1416445964801": 4020.1075,
- "1416445979801": 4020.2975,
- "1416445994801": 4020.4624999999996,
- "1416446009801": 4020.825,
- "1416446024801": 4020.96,
- "1416446084801": 4021.9725,
- "1416446099801": 4022.2,
- "1416446114801": 4022.3775,
- "1416446129801": 4022.7275,
- "1416446144801": 4022.98,
- "1416446204801": 4023.9425,
- "1416446219801": 4024.245,
- "1416446234801": 4024.5275,
- "1416446249801": 4024.925,
- "1416446264801": 4025.03,
- "1416446324801": 4026.2075,
- "1416446339801": 4026.4125,
- "1416446354801": 4026.5275,
- "1416446369801": 4026.915,
- "1416446384801": 4027.0550000000003,
- "1416446444801": 4028.0975,
- "1416446459801": 4028.2799999999997,
- "1416446474801": 4028.4275,
- "1416446489801": 4028.8375,
- "1416446504801": 4028.98,
- "1416446564801": 4030.005,
- "1416446579801": 4030.1800000000003,
- "1416446594801": 4030.365,
- "1416446609801": 4030.745,
- "1416446624801": 4030.895,
- "1416446684801": 4031.7825,
- "1416446699801": 4032.0175,
- "1416446714801": 4032.2025,
- "1416446729801": 4032.5525,
- "1416446744801": 4032.82,
- "1416446804801": 4033.7475,
- "1416446819801": 4033.9700000000003,
- "1416446834801": 4034.1425,
- "1416446849801": 4034.4725,
- "1416446864801": 4034.635,
- "1416446924801": 4035.54,
- "1416446939801": 4035.7175,
- "1416446954801": 4035.885,
- "1416446969801": 4036.255,
- "1416446984801": 4036.435,
- "1416447044801": 4037.8475,
- "1416447059801": 4038.045,
- "1416447074801": 4038.2025,
- "1416447089801": 4038.7,
- "1416447104801": 4038.855,
- "1416447164801": 4039.7375,
- "1416447179801": 4039.9025,
- "1416447194801": 4040.08,
- "1416447209801": 4040.42,
- "1416447224801": 4040.59,
- "1416447284801": 4041.51,
- "1416447299801": 4041.85,
- "1416447314801": 4042.6525,
- "1416447329801": 4043.1025,
- "1416447344801": 4043.29,
- "1416447404801": 4044.265,
- "1416447419801": 4044.52,
- "1416447434801": 4044.705,
- "1416447449801": 4045.09,
- "1416447464801": 4045.325,
- "1416447524801": 4046.2525,
- "1416447539801": 4046.3975,
- "1416447554801": 4046.55,
- "1416447569801": 4046.865,
- "1416447584801": 4047.0550000000003,
- "1416447644801": 4049.255,
- "1416448681363": 4105.1125,
- "1416448696363": 4105.3625,
- "1416448711363": 4105.6875,
- "1416448726363": 4105.842500000001,
- "1416448741363": 4105.9574999999995,
- "1416448756363": 4106.07,
- "1416448801363": 4106.74,
- "1416448816363": 4106.9175,
- "1416448831363": 4107.2,
- "1416448846363": 4107.3525,
- "1416448861363": 4107.545,
- "1416448876363": 4107.65,
- "1416448921363": 4109.2625,
- "1416448936363": 4109.4,
- "1416448936464": 4108.2
+ "1416445244801": 40.06085,
+ "1416445259801": 40.0629,
+ "1416445274801": 40.066475,
+ "1416445289801": 40.069474999999998,
+ "1416445304801": 40.071025,
+ "1416445319801": 40.0721,
+ "1416445364801": 40.078375,
+ "1416445379801": 40.080425000000005,
+ "1416445394801": 40.0837,
+ "1416445409801": 40.089474999999998,
+ "1416445424801": 40.0908,
+ "1416445439801": 40.09185,
+ "1416445484801": 40.099525,
+ "1416445499801": 40.1019,
+ "1416445514801": 40.108725,
+ "1416445529801": 40.113424999999997,
+ "1416445544801": 40.114975000000004,
+ "1416445559801": 40.11665,
+ "1416445604801": 40.1257,
+ "1416445619801": 40.129325,
+ "1416445634801": 40.133424999999997,
+ "1416445649801": 40.139225,
+ "1416445664801": 40.141949999999997,
+ "1416445679801": 40.1458,
+ "1416445724801": 40.1573,
+ "1416445739801": 40.158599999999997,
+ "1416445964801": 40.201075,
+ "1416445979801": 40.202975,
+ "1416445994801": 40.204624999999996,
+ "1416446009801": 40.20825,
+ "1416446024801": 40.2096,
+ "1416446084801": 40.219725,
+ "1416446099801": 40.222,
+ "1416446114801": 40.223775,
+ "1416446129801": 40.227275,
+ "1416446144801": 40.2298,
+ "1416446204801": 40.239425,
+ "1416446219801": 40.24245,
+ "1416446234801": 40.245275,
+ "1416446249801": 40.24925,
+ "1416446264801": 40.2503,
+ "1416446324801": 40.262075,
+ "1416446339801": 40.264125,
+ "1416446354801": 40.265275,
+ "1416446369801": 40.26915,
+ "1416446384801": 40.270550000000003,
+ "1416446444801": 40.280975,
+ "1416446459801": 40.282799999999997,
+ "1416446474801": 40.284275,
+ "1416446489801": 40.288375,
+ "1416446504801": 40.2898,
+ "1416446564801": 40.30005,
+ "1416446579801": 40.301800000000003,
+ "1416446594801": 40.30365,
+ "1416446609801": 40.30745,
+ "1416446624801": 40.30895,
+ "1416446684801": 40.317825,
+ "1416446699801": 40.320175,
+ "1416446714801": 40.322025,
+ "1416446729801": 40.325525,
+ "1416446744801": 40.3282,
+ "1416446804801": 40.337475,
+ "1416446819801": 40.339700000000003,
+ "1416446834801": 40.341425,
+ "1416446849801": 40.344725,
+ "1416446864801": 40.34635,
+ "1416446924801": 40.3554,
+ "1416446939801": 40.357175,
+ "1416446954801": 40.35885,
+ "1416446969801": 40.36255,
+ "1416446984801": 40.36435,
+ "1416447044801": 40.378475,
+ "1416447059801": 40.38045,
+ "1416447074801": 40.382025,
+ "1416447089801": 40.387,
+ "1416447104801": 40.38855,
+ "1416447164801": 40.397375,
+ "1416447179801": 40.399025,
+ "1416447194801": 40.4008,
+ "1416447209801": 40.4042,
+ "1416447224801": 40.4059,
+ "1416447284801": 40.4151,
+ "1416447299801": 40.4185,
+ "1416447314801": 40.426525,
+ "1416447329801": 40.431025,
+ "1416447344801": 40.4329,
+ "1416447404801": 40.44265,
+ "1416447419801": 40.4452,
+ "1416447434801": 40.44705,
+ "1416447449801": 40.4509,
+ "1416447464801": 40.45325,
+ "1416447524801": 40.462525,
+ "1416447539801": 40.463975,
+ "1416447554801": 40.4655,
+ "1416447569801": 40.46865,
+ "1416447584801": 40.470550000000003,
+ "1416447644801": 40.49255,
+ "1416448681363": 41.051125,
+ "1416448696363": 41.053625,
+ "1416448711363": 41.056875,
+ "1416448726363": 41.05842500000001,
+ "1416448741363": 41.059574999999995,
+ "1416448756363": 41.0607,
+ "1416448801363": 41.0674,
+ "1416448816363": 41.069175,
+ "1416448831363": 41.072,
+ "1416448846363": 41.073525,
+ "1416448861363": 41.07545,
+ "1416448876363": 41.0765,
+ "1416448921363": 41.092625,
+ "1416448936363": 41.094,
+ "1416448936464": 41.082
}
},
{
diff --git a/ambari-server/src/test/resources/ams/single_host_metric.json b/ambari-server/src/test/resources/ams/single_host_metric.json
index 59ec685217..8e3aa01446 100644
--- a/ambari-server/src/test/resources/ams/single_host_metric.json
+++ b/ambari-server/src/test/resources/ams/single_host_metric.json
@@ -7,118 +7,118 @@
"hostname": "h1",
"starttime": 1416445244801,
"metrics": {
- "1416445244801": 4006.085,
- "1416445259801": 4006.29,
- "1416445274801": 4006.6475,
- "1416445289801": 4006.9474999999998,
- "1416445304801": 4007.1025,
- "1416445319801": 4007.21,
- "1416445364801": 4007.8375,
- "1416445379801": 4008.0425000000005,
- "1416445394801": 4008.37,
- "1416445409801": 4008.9474999999998,
- "1416445424801": 4009.08,
- "1416445439801": 4009.185,
- "1416445484801": 4009.9525,
- "1416445499801": 4010.19,
- "1416445514801": 4010.8725,
- "1416445529801": 4011.3424999999997,
- "1416445544801": 4011.4975000000004,
- "1416445559801": 4011.665,
- "1416445604801": 4012.57,
- "1416445619801": 4012.9325,
- "1416445634801": 4013.3424999999997,
- "1416445649801": 4013.9225,
- "1416445664801": 4014.1949999999997,
- "1416445679801": 4014.58,
- "1416445724801": 4015.73,
- "1416445739801": 4015.8599999999997,
- "1416445964801": 4020.1075,
- "1416445979801": 4020.2975,
- "1416445994801": 4020.4624999999996,
- "1416446009801": 4020.825,
- "1416446024801": 4020.96,
- "1416446084801": 4021.9725,
- "1416446099801": 4022.2,
- "1416446114801": 4022.3775,
- "1416446129801": 4022.7275,
- "1416446144801": 4022.98,
- "1416446204801": 4023.9425,
- "1416446219801": 4024.245,
- "1416446234801": 4024.5275,
- "1416446249801": 4024.925,
- "1416446264801": 4025.03,
- "1416446324801": 4026.2075,
- "1416446339801": 4026.4125,
- "1416446354801": 4026.5275,
- "1416446369801": 4026.915,
- "1416446384801": 4027.0550000000003,
- "1416446444801": 4028.0975,
- "1416446459801": 4028.2799999999997,
- "1416446474801": 4028.4275,
- "1416446489801": 4028.8375,
- "1416446504801": 4028.98,
- "1416446564801": 4030.005,
- "1416446579801": 4030.1800000000003,
- "1416446594801": 4030.365,
- "1416446609801": 4030.745,
- "1416446624801": 4030.895,
- "1416446684801": 4031.7825,
- "1416446699801": 4032.0175,
- "1416446714801": 4032.2025,
- "1416446729801": 4032.5525,
- "1416446744801": 4032.82,
- "1416446804801": 4033.7475,
- "1416446819801": 4033.9700000000003,
- "1416446834801": 4034.1425,
- "1416446849801": 4034.4725,
- "1416446864801": 4034.635,
- "1416446924801": 4035.54,
- "1416446939801": 4035.7175,
- "1416446954801": 4035.885,
- "1416446969801": 4036.255,
- "1416446984801": 4036.435,
- "1416447044801": 4037.8475,
- "1416447059801": 4038.045,
- "1416447074801": 4038.2025,
- "1416447089801": 4038.7,
- "1416447104801": 4038.855,
- "1416447164801": 4039.7375,
- "1416447179801": 4039.9025,
- "1416447194801": 4040.08,
- "1416447209801": 4040.42,
- "1416447224801": 4040.59,
- "1416447284801": 4041.51,
- "1416447299801": 4041.85,
- "1416447314801": 4042.6525,
- "1416447329801": 4043.1025,
- "1416447344801": 4043.29,
- "1416447404801": 4044.265,
- "1416447419801": 4044.52,
- "1416447434801": 4044.705,
- "1416447449801": 4045.09,
- "1416447464801": 4045.325,
- "1416447524801": 4046.2525,
- "1416447539801": 4046.3975,
- "1416447554801": 4046.55,
- "1416447569801": 4046.865,
- "1416447584801": 4047.0550000000003,
- "1416447644801": 4049.255,
- "1416448681363": 4105.1125,
- "1416448696363": 4105.3625,
- "1416448711363": 4105.6875,
- "1416448726363": 4105.842500000001,
- "1416448741363": 4105.9574999999995,
- "1416448756363": 4106.07,
- "1416448801363": 4106.74,
- "1416448816363": 4106.9175,
- "1416448831363": 4107.2,
- "1416448846363": 4107.3525,
- "1416448861363": 4107.545,
- "1416448876363": 4107.65,
- "1416448921363": 4109.2625,
- "1416448936363": 4109.4,
- "1416448936464": 4108.2
+ "1416445244801": 40.06085,
+ "1416445259801": 40.0629,
+ "1416445274801": 40.066475,
+ "1416445289801": 40.069474999999998,
+ "1416445304801": 40.071025,
+ "1416445319801": 40.0721,
+ "1416445364801": 40.078375,
+ "1416445379801": 40.080425000000005,
+ "1416445394801": 40.0837,
+ "1416445409801": 40.089474999999998,
+ "1416445424801": 40.0908,
+ "1416445439801": 40.09185,
+ "1416445484801": 40.099525,
+ "1416445499801": 40.1019,
+ "1416445514801": 40.108725,
+ "1416445529801": 40.113424999999997,
+ "1416445544801": 40.114975000000004,
+ "1416445559801": 40.11665,
+ "1416445604801": 40.1257,
+ "1416445619801": 40.129325,
+ "1416445634801": 40.133424999999997,
+ "1416445649801": 40.139225,
+ "1416445664801": 40.141949999999997,
+ "1416445679801": 40.1458,
+ "1416445724801": 40.1573,
+ "1416445739801": 40.158599999999997,
+ "1416445964801": 40.201075,
+ "1416445979801": 40.202975,
+ "1416445994801": 40.204624999999996,
+ "1416446009801": 40.20825,
+ "1416446024801": 40.2096,
+ "1416446084801": 40.219725,
+ "1416446099801": 40.222,
+ "1416446114801": 40.223775,
+ "1416446129801": 40.227275,
+ "1416446144801": 40.2298,
+ "1416446204801": 40.239425,
+ "1416446219801": 40.24245,
+ "1416446234801": 40.245275,
+ "1416446249801": 40.24925,
+ "1416446264801": 40.2503,
+ "1416446324801": 40.262075,
+ "1416446339801": 40.264125,
+ "1416446354801": 40.265275,
+ "1416446369801": 40.26915,
+ "1416446384801": 40.270550000000003,
+ "1416446444801": 40.280975,
+ "1416446459801": 40.282799999999997,
+ "1416446474801": 40.284275,
+ "1416446489801": 40.288375,
+ "1416446504801": 40.2898,
+ "1416446564801": 40.30005,
+ "1416446579801": 40.301800000000003,
+ "1416446594801": 40.30365,
+ "1416446609801": 40.30745,
+ "1416446624801": 40.30895,
+ "1416446684801": 40.317825,
+ "1416446699801": 40.320175,
+ "1416446714801": 40.322025,
+ "1416446729801": 40.325525,
+ "1416446744801": 40.3282,
+ "1416446804801": 40.337475,
+ "1416446819801": 40.339700000000003,
+ "1416446834801": 40.341425,
+ "1416446849801": 40.344725,
+ "1416446864801": 40.34635,
+ "1416446924801": 40.3554,
+ "1416446939801": 40.357175,
+ "1416446954801": 40.35885,
+ "1416446969801": 40.36255,
+ "1416446984801": 40.36435,
+ "1416447044801": 40.378475,
+ "1416447059801": 40.38045,
+ "1416447074801": 40.382025,
+ "1416447089801": 40.387,
+ "1416447104801": 40.38855,
+ "1416447164801": 40.397375,
+ "1416447179801": 40.399025,
+ "1416447194801": 40.4008,
+ "1416447209801": 40.4042,
+ "1416447224801": 40.4059,
+ "1416447284801": 40.4151,
+ "1416447299801": 40.4185,
+ "1416447314801": 40.426525,
+ "1416447329801": 40.431025,
+ "1416447344801": 40.4329,
+ "1416447404801": 40.44265,
+ "1416447419801": 40.4452,
+ "1416447434801": 40.44705,
+ "1416447449801": 40.4509,
+ "1416447464801": 40.45325,
+ "1416447524801": 40.462525,
+ "1416447539801": 40.463975,
+ "1416447554801": 40.4655,
+ "1416447569801": 40.46865,
+ "1416447584801": 40.470550000000003,
+ "1416447644801": 40.49255,
+ "1416448681363": 41.051125,
+ "1416448696363": 41.053625,
+ "1416448711363": 41.056875,
+ "1416448726363": 41.05842500000001,
+ "1416448741363": 41.059574999999995,
+ "1416448756363": 41.0607,
+ "1416448801363": 41.0674,
+ "1416448816363": 41.069175,
+ "1416448831363": 41.072,
+ "1416448846363": 41.073525,
+ "1416448861363": 41.07545,
+ "1416448876363": 41.0765,
+ "1416448921363": 41.092625,
+ "1416448936363": 41.094,
+ "1416448936464": 41.082
}
}
]}