"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?
Created on 11-14-2019 08:00 PM - edited 11-14-2019 08:30 PM
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)
Created 11-03-2019 06:39 PM
Created 11-08-2019 01:17 AM
I am facing same issue with ambari 2.7.3 dashboard. Is this a bug?
Created 11-11-2019 05:52 PM
AMBARI-25170 was closed as "not a problem", obviously the reporter hadn't tested with container change.
Created 11-13-2019 02:47 AM
Hello,
Could you please add more insights here please to understand it explicitly. What do you mean by container change, is there a resolution for the mentioned issue.
Created on 11-14-2019 08:00 PM - edited 11-14-2019 08:30 PM
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)
Created 11-14-2019 10:42 PM
@jsensharma It works after the change. Thanks a lot for your help!
Created 01-21-2020 06:04 AM
Hey @jsensharma ,
Thanks for providing patch for this issue. I tested patch from https://github.com/apache/ambari/pull/3125/commits/973bb3fafdfb3c8e1f8516ca7a6efbb27897fb11 and it fix issue for yarn container metric.
But above accepted solution does not work for "yarn container" metrics. Trick is to find correct counterOrNA function as this function is available at 4 places in app.js file . Just thought to let you and others know.
Regards
Ajit Mote