Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution

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

New Contributor

"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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

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

Super Mentor

@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)

6 REPLIES 6

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

New Contributor

Screenshot_1.png

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

New Contributor

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

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

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

New Contributor

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

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

New Contributor

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. 

Highlighted

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

Super Mentor

@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)

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

New Contributor

@jsensharma  It works after the change. Thanks a lot for your help! 

Don't have an account?
Coming from Hortonworks? Activate your account here