AMBARI-15597. After enabling SSL for Resource Manager, getting a constant 
Ambari Alert: Connection failed to https://0.0.0.0:8044/ws/v1/node/info (No 
JSON object could be decoded) (dlysnichenko)


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

Branch: refs/heads/branch-2.2
Commit: af47269e9ccb2922bac1a9c7839e7478b6381109
Parents: 54e08ed
Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Authored: Mon Mar 28 13:32:00 2016 +0300
Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Committed: Mon Mar 28 13:33:04 2016 +0300

----------------------------------------------------------------------
 .../package/alerts/alert_nodemanager_health.py  | 32 +++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/af47269e/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py
index 2105bed..d7159e4 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py
@@ -81,6 +81,9 @@ def execute(configurations={}, parameters={}, host_name=None):
   if configurations is None:
     return (result_code, ['There were no configurations supplied to the 
script.'])
 
+  if host_name is None:
+    host_name = socket.getfqdn()
+
   scheme = 'http'
   http_uri = None
   https_uri = None
@@ -123,32 +126,31 @@ def execute(configurations={}, parameters={}, 
host_name=None):
 
 
   # determine the right URI and whether to use SSL
-  uri = http_uri
+  host_port = http_uri
   if http_policy == 'HTTPS_ONLY':
     scheme = 'https'
 
     if https_uri is not None:
-      uri = https_uri
+      host_port = https_uri
 
   label = ''
   url_response = None
   node_healthy = 'false'
   total_time = 0
 
+  # replace hostname on host fqdn to make it work on all environments
+  if host_port is not None:
+    if ":" in host_port:
+      uri_host, uri_port = host_port.split(':')
+      host_port = '{0}:{1}'.format(host_name, uri_port)
+    else:
+      host_port = host_name
+
   # some yarn-site structures don't have the web ui address
-  if uri is None:
-    if host_name is None:
-      host_name = socket.getfqdn()
-
-    uri = '{0}:{1}'.format(host_name, NODEMANAGER_DEFAULT_PORT)
-    
-  if OSCheck.is_windows_family():
-    uri_host, uri_port = uri.split(':')
-    # on windows 0.0.0.0 is invalid address to connect but on linux it 
resolved to 127.0.0.1
-    uri_host = resolve_address(uri_host)
-    uri = '{0}:{1}'.format(uri_host, uri_port)
-
-  query = "{0}://{1}/ws/v1/node/info".format(scheme,uri)
+  if host_port is None:
+    host_port = '{0}:{1}'.format(host_name, NODEMANAGER_DEFAULT_PORT)
+
+  query = "{0}://{1}/ws/v1/node/info".format(scheme, host_port)
 
   try:
     if kerberos_principal is not None and kerberos_keytab is not None and 
security_enabled:

Reply via email to