Просмотр исходного кода

AMBARI-1030. Metrics links in web ui should link to Ganglia UI. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418966 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 лет назад
Родитель
Сommit
4f89d2e064

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -420,6 +420,9 @@ AMBARI-666 branch (unreleased changes)
 
   IMPROVEMENTS
 
+  AMBARI-1030. Metrics links in web ui should link to Ganglia UI. (Srimanth
+  Gunturi via yusaku)
+
   AMBARI-1025. Display total install and start services time on summary page
   and polish summary page ui. (Jaimin Jetly via yusaku)
 

+ 29 - 0
ambari-web/app/controllers/global/cluster_controller.js

@@ -76,6 +76,35 @@ App.ClusterController = Em.Controller.extend({
     return (App.testMode) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
   },
 
+  /**
+   * Provides the URL to use for Ganglia server. This URL
+   * is helpful in populating links in UI.
+   *
+   * If null is returned, it means GANGLIA service is not installed.
+   */
+  gangliaUrl: function () {
+    if (App.testMode) {
+      return 'http://gangliaserver/ganglia/?t=yes';
+    } else {
+      // We want live data here
+      var svcs = App.Service.find();
+      var gangliaSvc = svcs.findProperty("serviceName", "GANGLIA");
+      if (gangliaSvc) {
+        var svcComponents = gangliaSvc.get('components');
+        if (svcComponents) {
+          var gangliaSvcComponent = svcComponents.findProperty("componentName", "GANGLIA_SERVER");
+          if (gangliaSvcComponent) {
+            var hostName = gangliaSvcComponent.get('host.hostName');
+            if (hostName) {
+              return "http://" + hostName + "/ganglia";
+            }
+          }
+        }
+      }
+      return null;
+    }
+  }.property('dataLoadList.services'),
+
   /**
    * Provides the URL to use for NAGIOS server. This URL
    * is helpful in getting alerts data from server and also

+ 3 - 1
ambari-web/app/templates/main/dashboard.hbs

@@ -38,7 +38,9 @@
 			<div class="box-header">
 				<h4>Cluster Metrics</h4>
 				<div class="btn-group">
-          <a class="btn" href="http://gangliaserver/ganglia/?t=yes" target="_blank" rel="tooltip" title="Go to Ganglia"><i class="icon-link"></i></a>
+        </div>
+				<div class="btn-group">
+          <a class="btn" target="_blank" rel="tooltip" title="Go to Ganglia" {{bindAttr href="view.gangliaUrl"}}><i class="icon-link"></i></a>
         </div>
 			</div>
 			<div class="graphs-container">

+ 3 - 0
ambari-web/app/templates/main/host/summary.hbs

@@ -88,6 +88,9 @@
     <div class="box">
       <div class="box-header">
         <h4>Host Metrics</h4>
+        <div class="btn-group">
+          <a class="btn" rel="tooltip" title="Go to Ganglia" {{action "showGangliaCharts" target="view"}}><i class="icon-link"></i></a>
+        </div>
       </div>
       <div class="row-fluid">
 	     {{view App.MainHostMetricsView contentBinding="view.content"}}

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

@@ -178,6 +178,9 @@
     <div class="box">
       <div class="box-header">
         <h4>{{controller.content.label}} Metrics</h4>
+        <div class="btn-group">
+          <a class="btn" target="_blank" rel="tooltip" title="Go to Ganglia" {{bindAttr href="view.gangliaUrl"}}><i class="icon-link"></i></a>
+        </div>
       </div>
       
       <div class="summary-metric-graphs row-fluid">

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

@@ -63,5 +63,9 @@ App.MainDashboardView = Em.View.extend({
       })
     }, this);
 
-  }.observes('App.router.clusterController.dataLoadList.services')
+  }.observes('App.router.clusterController.dataLoadList.services'),
+  
+  gangliaUrl: function () {
+    return App.router.get('clusterController.gangliaUrl') + "/?r=hour&cs=&ce=&m=&s=by+name&c=HDPSlaves&tab=m&vn=";
+  }.property('App.router.clusterController.gangliaUrl')
 });

+ 7 - 0
ambari-web/app/views/main/host/summary.js

@@ -24,6 +24,13 @@ App.MainHostSummaryView = Em.View.extend({
   content:function(){
     return App.router.get('mainHostDetailsController.content');
   }.property('App.router.mainHostDetailsController.content'),
+  
+
+  showGangliaCharts: function () {
+    var name = this.get('content.hostName');
+    var gangliaMobileUrl = App.router.get('clusterController.gangliaUrl') + "/mobile_helper.php?show_host_metrics=1&h=" + name + "&c=HDPNameNode&r=hour&cs=&ce=";
+    window.open(gangliaMobileUrl);
+  },
 
   ComponentButtonView: Em.View.extend({
     content: null,

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

@@ -148,7 +148,28 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     this.set('oldServiceName', serviceName);
     serviceName = serviceName.toLowerCase();
   }.observes('serviceName'),
-
+  
+  gangliaUrl: function () {
+    var gangliaUrl = App.router.get('clusterController.gangliaUrl');
+    var svcName = this.get('service.serviceName');
+    if (svcName) {
+      switch (svcName.toLowerCase()) {
+        case 'hdfs':
+          gangliaUrl += "/?r=hour&cs=&ce=&m=&s=by+name&c=HDPNameNode&tab=m&vn=";
+          break;
+        case 'mapreduce':
+          gangliaUrl += "/?r=hour&cs=&ce=&m=&s=by+name&c=HDPJobTracker&tab=m&vn=";
+          break;
+        case 'hbase':
+          gangliaUrl += "?r=hour&cs=&ce=&m=&s=by+name&c=HDPHBaseMaster&tab=m&vn=";
+          break;
+        default:
+          break;
+      }
+    }
+    return gangliaUrl;
+  }.property('App.router.clusterController.gangliaUrl', 'service.serviceName'),
+  
   didInsertElement:function () {
     // We have to make the height of the Alerts section
     // match the height of the Summary section.