Skip to main content
JayZhang
Silver ⭐️⭐️
Nov 1, 2019 6:17 AM UTC
Solved

Ambari 2.7.3 Dashboard "Yarn Container" widget shows n/a when number of containers is other than 0

"Yarn Container" widget shows 0/0/0 when no containers are allocated,pending or reserved, but if any of the 3 metrics changed, the widget shows n/a, wonder if it is a bug or not?

jsensharma
Platinum ⭐️⭐️
Nov 15, 2019 4:00 AM UTC

@JayZhang 


Until the mentioned JIRA is fixed permanently can you  please try this workaround. One time One line change inside the "/usr/lib/ambari-server/web/javascripts/app.js" file should work.

 

Step-1). Take a Safe Backup of the file "/usr/lib/ambari-server/web/javascripts/app.js" on ambari server host.

 

# cp -f /usr/lib/ambari-server/web/javascripts/app.js /PATH/To/Backup/app.js.ORIGINAL

 


Step-2). Also just above the "App.YarnContainersView = App.TextDashboardWidgetView.extend" line inside the above file you will see a function declaration like "counterOr" we will need to make one change there.

(BEFORE CHANGE)

 

# grep -B12 'App.YarnContainersView' /usr/lib/ambari-server/web/javascripts/app.js

var App = require('app');

function counterOrNA(key) {
var _key = 'model.{0}.length'.format(key);
return Em.computed(_key, function () {
if (Em.isNone(this.get('model.' + key)) || this.get('model.metricsNotAvailable')) {
return Em.I18n.t('services.service.summary.notAvailable');
}
return this.get(_key);
});
}

 

 

Step-3).  IN the above function block you will see a line as "var _key = 'model.{0}.length'.format(key);"
We need to just remove the ".length" work from that string.

(AFTER CHANGE)

 

# grep -B12 'App.YarnContainersView' /usr/lib/ambari-server/web/javascripts/app.js 

var App = require('app');

function counterOrNA(key) {
var _key = 'model.{0}'.format(key);
return Em.computed(_key, function () {
if (Em.isNone(this.get('model.' + key)) || this.get('model.metricsNotAvailable')) {
return Em.I18n.t('services.service.summary.notAvailable');
}
return this.get(_key);
});
}

 


Step-4).  Save the file and then Hard Refresh the Browser. On Mac (command + Shift + R)

7 replies

JayZhang
JayZhangAuthor
Silver ⭐️⭐️
Nov 4, 2019 2:39 AM UTC

Screenshot_1.png

Translate
cvrocks
Silver ⭐️⭐️
Nov 8, 2019 9:17 AM UTC

I am facing same issue with ambari 2.7.3 dashboard. Is this a bug? 

https://issues.apache.org/jira/browse/AMBARI-25170

Translate
JayZhang
JayZhangAuthor
Silver ⭐️⭐️
Nov 12, 2019 1:52 AM UTC

AMBARI-25170 was closed as "not a problem", obviously the reporter hadn't tested with container change.

Translate