Repository: ambari Updated Branches: refs/heads/trunk 7256ef0b9 -> badef3dcc
AMBARI-15822 Enable HDFS alerts based on AMS metrics by default. (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/badef3dc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/badef3dc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/badef3dc Branch: refs/heads/trunk Commit: badef3dcc145043cee9d15f0e26c4c3a1307c937 Parents: 7256ef0 Author: Dmytro Sen <[email protected]> Authored: Tue Apr 12 19:07:55 2016 +0300 Committer: Dmytro Sen <[email protected]> Committed: Tue Apr 12 19:08:22 2016 +0300 ---------------------------------------------------------------------- .../common-services/HDFS/2.1.0.2.0/alerts.json | 24 ++++++++++---------- .../2.0.6/HDFS/test_alert_metrics_deviation.py | 13 ++++++++--- 2 files changed, 22 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/badef3dc/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json index f5fcc76..4dc52a2 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json @@ -620,7 +620,7 @@ "description": "This service-level alert is triggered if the deviation of RPC queue latency on datanode port has grown beyond the specified threshold within a given time interval.", "interval": 5, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -688,7 +688,7 @@ "description": "This service-level alert is triggered if the deviation of RPC queue latency on client port has grown beyond the specified threshold within a given time interval.", "interval": 5, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -756,7 +756,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within a given time interval.", "interval": 5, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -824,7 +824,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within a given time interval.", "interval": 5, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -892,7 +892,7 @@ "description": "This service-level alert is triggered if the NN heap usage deviation has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -953,7 +953,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1021,7 +1021,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1089,7 +1089,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1157,7 +1157,7 @@ "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1225,7 +1225,7 @@ "description": "This service-level alert is triggered if the increase in storage capacity usage deviation has grown beyond the specified threshold within a given time interval.", "interval": 480, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1286,7 +1286,7 @@ "description": "This service-level alert is triggered if the NN heap usage deviation has grown beyond the specified threshold within a given time interval.", "interval": 1440, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", @@ -1347,7 +1347,7 @@ "description": "This service-level alert is triggered if the increase in storage capacity usage deviation has grown beyond the specified threshold within a given time interval.", "interval": 1440, "scope": "ANY", - "enabled": false, + "enabled": true, "source": { "type": "SCRIPT", "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py", http://git-wip-us.apache.org/repos/asf/ambari/blob/badef3dc/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py index 8a35ab5..5809010 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py @@ -96,11 +96,11 @@ class TestAlertMetricsDeviation(RMFTestCase): @patch("httplib.HTTPConnection") def test_alert(self, conn_mock): - ca_connection = MagicMock() + connection = MagicMock() response = MagicMock() response.status = 200 - ca_connection.getresponse.return_value = response - conn_mock.return_value = ca_connection + connection.getresponse.return_value = response + conn_mock.return_value = connection response.read.return_value = '{"metrics":[{"metricname":"metric1","metrics":{"1459966360838":1,"1459966370838":3}}]}' # OK, but no datapoints above the minimum threshold @@ -137,3 +137,10 @@ class TestAlertMetricsDeviation(RMFTestCase): self.assertEqual(status, RESULT_STATE_UNKNOWN) self.assertTrue(messages is not None and len(messages) == 1) self.assertEquals('Unable to retrieve metrics from AMS.', messages[0]) + + # Unable to connect to AMS + conn_mock.side_effect = Exception('Unable to connect to AMS') + [status, messages] = alert.execute(configurations=configs, parameters=parameters) + self.assertEqual(status, RESULT_STATE_UNKNOWN) + self.assertTrue(messages is not None and len(messages) == 1) + self.assertEquals('Unable to retrieve metrics from AMS.', messages[0])
