AMBARI-14686. YARN service check was failed on cluster with enabled NN and Rm 
HAs (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/07bfbc4f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/07bfbc4f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/07bfbc4f

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 07bfbc4fe1c594c69db035ac85dcd5de7e997a74
Parents: 696c404
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Fri Jan 15 15:46:43 2016 +0200
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Fri Jan 15 15:46:43 2016 +0200

----------------------------------------------------------------------
 .../YARN/2.1.0.2.0/package/scripts/params_linux.py | 17 +++++++++++++++++
 .../2.1.0.2.0/package/scripts/service_check.py     |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/07bfbc4f/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index f4efa9d..f0b6927 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -315,6 +315,23 @@ scheme = 'http' if not yarn_https_on else 'https'
 yarn_rm_address = 
config['configurations']['yarn-site']['yarn.resourcemanager.webapp.address'] if 
not yarn_https_on else 
config['configurations']['yarn-site']['yarn.resourcemanager.webapp.https.address']
 rm_active_port = rm_https_port if yarn_https_on else rm_port
 
+rm_ha_enabled = False
+rm_ha_ids_list = []
+rm_webapp_addresses_list = [yarn_rm_address]
+rm_ha_ids = 
default("/configurations/yarn-site/yarn.resourcemanager.ha.rm-ids", None)
+
+if rm_ha_ids:
+  rm_ha_ids_list = rm_ha_ids.split(",")
+  if len(rm_ha_ids_list) > 1:
+    rm_ha_enabled = True
+
+if rm_ha_enabled:
+  rm_webapp_addresses_list = []
+  for rm_id in rm_ha_ids_list:
+    rm_webapp_address_property = 
format('yarn.resourcemanager.webapp.address.{rm_id}') if not yarn_https_on else 
format('yarn.resourcemanager.webapp.https.address.{rm_id}')
+    rm_webapp_address = 
config['configurations']['yarn-site'][rm_webapp_address_property]
+    rm_webapp_addresses_list.append(rm_webapp_address)
+
 #ranger yarn properties
 if has_ranger_admin:
   is_supported_yarn_ranger = 
config['configurations']['yarn-env']['is_supported_yarn_ranger']

http://git-wip-us.apache.org/repos/asf/ambari/blob/07bfbc4f/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
index 6aca8b2..cd4d558 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
@@ -114,8 +114,8 @@ class ServiceCheckDefault(ServiceCheck):
         application_name = item
 
     json_response_received = False
-    for rm_host in params.rm_hosts:
-      info_app_url = params.scheme + "://" + rm_host + ":" + 
params.rm_active_port + "/ws/v1/cluster/apps/" + application_name
+    for rm_webapp_address in params.rm_webapp_addresses_list:
+      info_app_url = params.scheme + "://" + rm_webapp_address + 
"/ws/v1/cluster/apps/" + application_name
 
       get_app_info_cmd = "curl --negotiate -u : -ksL --connect-timeout " + 
CURL_CONNECTION_TIMEOUT + " " + info_app_url
 

Reply via email to