You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/08/15 16:48:11 UTC
git commit: AMBARI-6877. NameNode CPU metrics are missing
(alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk a10f42a7a -> ea915a0d2
AMBARI-6877. NameNode CPU metrics are missing (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea915a0d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea915a0d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea915a0d
Branch: refs/heads/trunk
Commit: ea915a0d248c344823365ce75a99a5badd328cdf
Parents: a10f42a
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Aug 15 17:45:37 2014 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Aug 15 17:45:37 2014 +0300
----------------------------------------------------------------------
ambari-web/app/models/service/hdfs.js | 1 -
ambari-web/app/utils/ajax/ajax.js | 4 +++
.../main/dashboard/widgets/namenode_cpu.js | 37 +++++++++++++++++---
3 files changed, 37 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea915a0d/ambari-web/app/models/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/hdfs.js b/ambari-web/app/models/service/hdfs.js
index f62e167..b34a4e8 100644
--- a/ambari-web/app/models/service/hdfs.js
+++ b/ambari-web/app/models/service/hdfs.js
@@ -48,7 +48,6 @@ App.HDFSService = App.Service.extend({
dfsTotalFiles: DS.attr('number'),
upgradeStatus: DS.attr('boolean'),
safeModeStatus: DS.attr('string'),
- nameNodeCpu: DS.attr('number'),
nameNodeRpc: DS.attr('number')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea915a0d/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 4ad4572..2f6a464 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1797,6 +1797,10 @@ var urls = {
'real': '/clusters/{clusterName}/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/os_type,Hosts/ip,host_components,metrics/disk,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free&minimal_response=true',
'mock': ''
},
+ 'namenode.cpu_wio': {
+ 'real': '/clusters/{clusterName}/hosts/{nnHost}?fields=metrics/cpu',
+ 'mock': ''
+ },
'custom_action.create': {
'real': '/requests',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea915a0d/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
index 86cda03..6fca69e 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
@@ -25,15 +25,44 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({
model_type: 'hdfs',
widgetHtmlId: 'widget-nn-cpu',
- modelFieldUsed: 'nameNodeCpu',
+ cpuWio: null,
+ nnHostName:"",
didInsertElement: function() {
this._super();
+ var self = this;
+ if (App.get('isHaEnabled')) {
+ this.set('nnHostName', this.get('model').get('activeNameNode.hostName'));
+ }else{
+ this.set('nnHostName', this.get('model').get('nameNode.hostName'));
+ }
+ this.getValue();
+ setInterval(function() {self.getValue()}, App.componentsUpdateInterval);
+ },
+
+ getValue: function () {
+ App.ajax.send({
+ name: 'namenode.cpu_wio',
+ sender: this,
+ data: {
+ nnHost: this.get('nnHostName')
+ },
+ success: 'updateValueSuccess',
+ error: 'updateValueError'
+ });
+ },
+
+ updateValueError: function () {
+ this.calc();
+ },
+
+ updateValueSuccess: function (response) {
+ this.set('cpuWio', response.metrics.cpu.cpu_wio);
this.calc();
},
calcHiddenInfo: function() {
- var value = this.get('model').get(this.get('modelFieldUsed'));
+ var value = this.get('cpuWio');
var obj1;
if( value == null) {
obj1 = Em.I18n.t('services.service.summary.notAvailable');
@@ -49,11 +78,11 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({
},
calcIsPieExists: function() {
- return (this.get('model').get(this.get('modelFieldUsed')) != null);
+ return (this.get('cpuWio') != null);
},
calcDataForPieChart: function() {
- var value = this.get('model').get(this.get('modelFieldUsed'));
+ var value = this.get('cpuWio');
value = value >= 100 ? 100: value;
var percent = (value + 0).toFixed(1);
var percent_precise = (value + 0).toFixed(2);