Skip to content

Commit

Permalink
AMBARI-1030. Metrics links in web ui should link to Ganglia UI. (Srim…
Browse files Browse the repository at this point in the history
…anth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418966 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Yusaku Sako committed Dec 9, 2012
1 parent 0769fc6 commit 4f89d2e
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 3 deletions.
3 changes: 3 additions & 0 deletions AMBARI-666-CHANGES.txt
Expand Up @@ -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)

Expand Down
29 changes: 29 additions & 0 deletions ambari-web/app/controllers/global/cluster_controller.js
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ambari-web/app/templates/main/dashboard.hbs
Expand Up @@ -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">
Expand Down
3 changes: 3 additions & 0 deletions ambari-web/app/templates/main/host/summary.hbs
Expand Up @@ -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"}}
Expand Down
3 changes: 3 additions & 0 deletions ambari-web/app/templates/main/service/info/summary.hbs
Expand Up @@ -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">
Expand Down
6 changes: 5 additions & 1 deletion ambari-web/app/views/main/dashboard.js
Expand Up @@ -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 changes: 7 additions & 0 deletions ambari-web/app/views/main/host/summary.js
Expand Up @@ -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,
Expand Down
23 changes: 22 additions & 1 deletion ambari-web/app/views/main/service/info/summary.js
Expand Up @@ -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.
Expand Down

0 comments on commit 4f89d2e

Please sign in to comment.