Bladeren bron

AMBARI-1366. Nagios alert tweaks. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1443740 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 jaren geleden
bovenliggende
commit
f19200235e

+ 2 - 0
CHANGES.txt

@@ -40,6 +40,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1366. Nagios alert tweaks. (jaimin)
+
  AMBARI-1365. Make Hosts table update dynamically. (jaimin)
 
  AMBARI-1361. Install progress dialog WARN icon + color. (jaimin)

+ 4 - 4
ambari-web/app/controllers/main/host.js

@@ -25,8 +25,8 @@ App.MainHostController = Em.ArrayController.extend({
   content: App.Host.find(),
   comeWithFilter: false,
 
-  hostsWithAlerts: function () {
-    return App.router.get('clusterController.alerts').filterProperty('isOk', false).mapProperty('hostName').uniq();
+  alerts: function () {
+    return App.router.get('clusterController.alerts').filterProperty('isOk', false).filterProperty('ignoredForHosts', false);
   }.property('App.router.clusterController.alerts.length'),
 
   /**
@@ -111,9 +111,9 @@ App.MainHostController = Em.ArrayController.extend({
       header: this.t('services.alerts.headingOfList'),
       bodyClass: Ember.View.extend({
         hostAlerts: function () {
-          var allAlerts = App.router.get('clusterController.alerts');
+          var allAlerts = App.router.get('clusterController.alerts').filterProperty('ignoredForHosts', false);
           if (host) {
-            return allAlerts.filterProperty('hostName', host.get('hostName')).filterProperty('isOk', false);
+            return allAlerts.filterProperty('hostName', host.get('hostName'));
           }
           return 0;
         }.property('App.router.clusterController.alerts'),

+ 1 - 1
ambari-web/app/controllers/main/service/info/summary.js

@@ -27,7 +27,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({
     var serviceId = this.get('content.serviceName');
     if (serviceId) {
       return this.get('allAlerts').filter(function (item) {
-        return item.get('serviceType') && item.get('serviceType').toLowerCase() == serviceId.toLowerCase();
+        return item.get('serviceType').toLowerCase() == serviceId.toLowerCase() && !item.get('ignoredForServices');
       });
     }
     return [];

+ 14 - 0
ambari-web/app/models/alert.js

@@ -60,6 +60,20 @@ App.Alert = DS.Model.extend({
     return this.get('status') == "1";
   }.property('status'),
 
+  /**
+   * Used to show only required alerts at the service level
+   */
+  ignoredForServices: function() {
+    return ['TaskTracker process down', 'RegionServer process down', 'DataNode process down', 'DataNode storage full', 'ZooKeeper Server process down'].contains(this.get('title'));
+  }.property('title'),
+
+  /**
+   * Used to show only required alerts at the host level
+   */
+  ignoredForHosts: function() {
+    return this.get('title').indexOf('Percent') != -1;
+  }.property('title'),
+
   /**
    * Provides how long ago this alert happened.
    * 

+ 1 - 1
ambari-web/app/models/host.js

@@ -53,7 +53,7 @@ App.Host = DS.Model.extend({
   loadFifteen:DS.attr('number'),
 
   criticalAlertsCount: function () {
-    return App.router.get('clusterController.alerts').filterProperty('hostName', this.get('hostName')).filterProperty('isOk', false).length;
+    return App.router.get('clusterController.alerts').filterProperty('hostName', this.get('hostName')).filterProperty('isOk', false).filterProperty('ignoredForHosts', false).length;
   }.property('App.router.clusterController.alerts.length'),
 
   publicHostNameFormatted: function() {

+ 2 - 2
ambari-web/app/templates/main/host/details.hbs

@@ -19,9 +19,9 @@
 <div id="host-details">
   <span {{bindAttr class="view.content.healthClass"}} {{bindAttr title="view.content.healthToolTip" }}></span><span class='host-title'>{{unbound view.content.publicHostName}}</span>
   {{#if view.content.criticalAlertsCount}}
-  <span class="label label-important alerts-count" {{action "showAlertsPopup" content target="App.router.mainHostController"}}>{{view.content.criticalAlertsCount}}</span>
+    <span class="label label-important alerts-count" {{action "showAlertsPopup" content target="App.router.mainHostController"}}>{{view.content.criticalAlertsCount}}</span>
   {{else}}
-    <span class="label label-success alerts-count">{{t hosts.host.alert.noAlerts}}</span>
+    <span class="label label-success alerts-count" {{action "showAlertsPopup" content target="App.router.mainHostController"}}>{{t hosts.host.alert.noAlerts}}</span>
   {{/if}}
   <div><a href="javascript:void(null)" data-toggle="modal" {{action backToHostsList}}><i class="icon-arrow-left"></i>&nbsp;{{t hosts.host.back}}</a></div>
 <!--   {{#if App.isAdmin}} -->

+ 0 - 2
ambari-web/app/templates/main/service/info/summary.hbs

@@ -112,7 +112,6 @@
 </div>
 </div>
 <div class="span6">
-  {{#if view.hasAlertsBox }}
 	<div class="box">
 		<div class="box-header">
 			<h4>{{t services.alerts.headingOfList}}</h4>
@@ -138,7 +137,6 @@
 			{{/if}}
 		</ul>
 	</div>
-  {{/if}}
 </div>
 </div>
 {{#if view.serviceMetricGraphs.length}}

+ 1 - 1
ambari-web/app/views/main/dashboard.js

@@ -96,7 +96,7 @@ App.MainDashboardView = Em.View.extend({
           var allAlerts = App.router.get('clusterController.alerts');
           var serviceId = this.get('service.serviceName');
           if (serviceId) {
-            return allAlerts.filterProperty('serviceType', serviceId).filterProperty('isOk', false);
+            return allAlerts.filterProperty('serviceType', serviceId).filterProperty('isOk', false).filterProperty('ignoredForServices', false);
           }
           return 0;
         }.property('App.router.clusterController.alerts'),

+ 1 - 1
ambari-web/app/views/main/dashboard/service.js

@@ -92,7 +92,7 @@ App.MainDashboardServiceView = Em.View.extend({
 
   criticalAlertsCount: function () {
     var alerts = App.router.get('clusterController.alerts');
-    return alerts.filterProperty('serviceType', this.get('service.id')).filterProperty('isOk', false).length;
+    return alerts.filterProperty('serviceType', this.get('service.id')).filterProperty('isOk', false).filterProperty('ignoredForServices', false).length;
   }.property('App.router.clusterController.alerts'),
 
   isCollapsed: false,

+ 2 - 2
ambari-web/app/views/main/menu.js

@@ -68,9 +68,9 @@ App.MainMenuView = Em.CollectionView.extend({
 
     alertsCount:function () {
       if (this.get('content').routing == 'hosts') {
-        return App.router.get('mainHostController.hostsWithAlerts').length;
+        return App.router.get('mainHostController.alerts').length;
       }
-    }.property('App.router.mainHostController.hostsWithAlerts.length'),
+    }.property('App.router.mainHostController.alerts.length'),
 
     templateName: require('templates/main/menu_item')
   })

+ 1 - 7
ambari-web/app/views/main/service/info/summary.js

@@ -394,11 +394,5 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     });
 
     return names.length ? names.join(', ') : false;
-  }.property('clientComponents'),
-  hasAlertsBox: function(){
-    var services = [
-      'NAGIOS'
-    ];
-    return -1 === services.indexOf(this.get('controller.content.serviceName'));
-  }.property('controller.content.serviceName')
+  }.property('clientComponents')
 });

+ 1 - 1
ambari-web/app/views/main/service/menu.js

@@ -64,7 +64,7 @@ App.MainServiceMenuView = Em.CollectionView.extend({
       var allAlerts = App.router.get('clusterController.alerts');
       var serviceId = this.get('content.serviceName');
       if (serviceId) {
-        return allAlerts.filterProperty('serviceType', serviceId).filterProperty('isOk', false).length;
+        return allAlerts.filterProperty('serviceType', serviceId).filterProperty('isOk', false).filterProperty('ignoredForServices', false).length;
       }
       return 0;
     }.property('App.router.clusterController.alerts'),