|
@@ -100,6 +100,7 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
"https" : "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
|
|
|
"https_property" : "{{yarn-site/yarn.http.policy}}",
|
|
|
"https_property_value" : "HTTPS_ONLY",
|
|
|
+ "connection_timeout" : 5.0,
|
|
|
"default_port" : 0.0
|
|
|
}
|
|
|
}
|
|
@@ -191,6 +192,59 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
"uri" : "{{zookeeper-env/clientPort}}"
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "AlertDefinition" : {
|
|
|
+ "component_name" : "NAMENODE",
|
|
|
+ "description" : "This service-level alert is triggered if the NN heap usage deviation has grown beyond the specified threshold within a given time interval.",
|
|
|
+ "enabled" : true,
|
|
|
+ "help_url" : null,
|
|
|
+ "id" : 6,
|
|
|
+ "ignore_host" : false,
|
|
|
+ "interval" : 1,
|
|
|
+ "label" : "NameNode Heap Usage (Hourly)",
|
|
|
+ "name" : "namenode_free_heap_size_deviation_percentage",
|
|
|
+ "repeat_tolerance" : 1,
|
|
|
+ "repeat_tolerance_enabled" : true,
|
|
|
+ "scope" : "SERVICE",
|
|
|
+ "service_name" : "HDFS",
|
|
|
+ "source" : {
|
|
|
+ "ams" : {
|
|
|
+ "metric_list" : [
|
|
|
+ "jvm.JvmMetrics.MemHeapUsedM",
|
|
|
+ "jvm.JvmMetrics.MemHeapMaxM"
|
|
|
+ ],
|
|
|
+ "value" : "{1} - {0}",
|
|
|
+ "interval" : 60.0,
|
|
|
+ "compute" : "sample_standard_deviation_percentage",
|
|
|
+ "app_id" : "NAMENODE",
|
|
|
+ "minimum_value" : 1.0
|
|
|
+ },
|
|
|
+ "reporting" : {
|
|
|
+ "ok" : {
|
|
|
+ "text" : "The sample standard deviation percentage is {0}%"
|
|
|
+ },
|
|
|
+ "warning" : {
|
|
|
+ "text" : "The sample standard deviation percentage is {0}%",
|
|
|
+ "value" : 20.0
|
|
|
+ },
|
|
|
+ "critical" : {
|
|
|
+ "text" : "The sample standard deviation percentage is {0}%",
|
|
|
+ "value" : 50.0
|
|
|
+ },
|
|
|
+ "units" : "%"
|
|
|
+ },
|
|
|
+ "type" : "AMS",
|
|
|
+ "uri" : {
|
|
|
+ "http" : "{{ams-site/timeline.metrics.service.webapp.address}}",
|
|
|
+ "https" : "{{ams-site/timeline.metrics.service.webapp.address}}",
|
|
|
+ "https_property" : "{{ams-site/timeline.metrics.service.http.policy}}",
|
|
|
+ "https_property_value" : "HTTPS_ONLY",
|
|
|
+ "default_port" : 0.0,
|
|
|
+ "connection_timeout" : 5.0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
};
|
|
@@ -202,7 +256,8 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
'parameterModel': {},
|
|
|
'reportModel': {},
|
|
|
'metricsSourceModel': {},
|
|
|
- 'metricsUriModel': {}
|
|
|
+ 'metricsUriModel': {},
|
|
|
+ 'metricsAmsModel': {}
|
|
|
});
|
|
|
|
|
|
sinon.stub(App.alertDefinitionsMapper, 'deleteRecord', Em.K);
|
|
@@ -230,7 +285,8 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
|
|
|
'reportModel': App.AlertReportDefinition,
|
|
|
'metricsSourceModel': App.AlertMetricsSourceDefinition,
|
|
|
- 'metricsUriModel': App.AlertMetricsUriDefinition
|
|
|
+ 'metricsUriModel': App.AlertMetricsUriDefinition,
|
|
|
+ 'metricsAmsModel': App.AlertMetricsAmsDefinition
|
|
|
});
|
|
|
|
|
|
App.alertDefinitionsMapper.deleteRecord.restore();
|
|
@@ -320,7 +376,8 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
"http":"{{yarn-site/yarn.resourcemanager.webapp.address}}",
|
|
|
"https":"{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
|
|
|
"https_property":"{{yarn-site/yarn.http.policy}}",
|
|
|
- "https_property_value":"HTTPS_ONLY"
|
|
|
+ "https_property_value":"HTTPS_ONLY",
|
|
|
+ "connection_timeout" : 5.0
|
|
|
}];
|
|
|
|
|
|
beforeEach(function () {
|
|
@@ -433,6 +490,57 @@ describe('App.alertDefinitionsMapper', function () {
|
|
|
|
|
|
});
|
|
|
|
|
|
+ describe('should parse AMS alertDefinitions', function () {
|
|
|
+
|
|
|
+ var data = {items: [json.items[5]]};
|
|
|
+ var expected = [
|
|
|
+ {
|
|
|
+ "id" : 6,
|
|
|
+ "interval" : 1,
|
|
|
+ "label" : "NameNode Heap Usage (Hourly)",
|
|
|
+ "name" : "namenode_free_heap_size_deviation_percentage",
|
|
|
+ "repeat_tolerance" : 1,
|
|
|
+ "repeat_tolerance_enabled" : true,
|
|
|
+ "scope" : "SERVICE",
|
|
|
+ "service_name" : "HDFS",
|
|
|
+ "component_name" : "NAMENODE",
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ var expectedMetricsUri = [{
|
|
|
+ "id":"6uri",
|
|
|
+ "http" : "{{ams-site/timeline.metrics.service.webapp.address}}",
|
|
|
+ "https" : "{{ams-site/timeline.metrics.service.webapp.address}}",
|
|
|
+ "https_property" : "{{ams-site/timeline.metrics.service.http.policy}}",
|
|
|
+ "https_property_value" : "HTTPS_ONLY",
|
|
|
+ "connection_timeout" : 5.0
|
|
|
+ }];
|
|
|
+
|
|
|
+ var expectedAms = [{
|
|
|
+ "id": "6ams",
|
|
|
+ "value": "{1} - {0}",
|
|
|
+ "minimal_value": 1,
|
|
|
+ "interval": 60
|
|
|
+ }];
|
|
|
+
|
|
|
+ beforeEach(function () {
|
|
|
+ App.alertDefinitionsMapper.map(data);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should map definition', function () {
|
|
|
+ testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
|
|
|
+ });
|
|
|
+
|
|
|
+ it('parse metrics uri', function() {
|
|
|
+ testHelpers.nestedExpect(expectedMetricsUri, App.alertDefinitionsMapper.get('metricsUriModel.content'));
|
|
|
+ });
|
|
|
+
|
|
|
+ it('parse ams parameters', function () {
|
|
|
+ testHelpers.nestedExpect(expectedAms, App.alertDefinitionsMapper.get('metricsAmsModel.content'));
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
/*eslint-disable mocha-cleanup/complexity-it */
|
|
|
it('should set groups from App.cache.previousAlertGroupsMap', function () {
|
|
|
|