This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Quick Links

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

A service can add a list of quick links to the Ambari web UI by adding metainfo to a text file following a predefined JSON format. Ambari server parses the quicklink JSON file and provides its content to the UI. So that Ambari web UI can calculate quick link URLs based on the information and populate the quicklinks drop-down list accordingly.

...


Use YARN as an example, the following is what the metainfo.xml looks like with the quiclinks configurations.

<services>

<service>

<name>YARN</name>

Code Block
languagexml
themeEclipse
firstline1
linenumberstrue
<services>
    <service>
    <name>YARN</name>
    <version>2.7.1.2.3</version>

...

… …

<quickLinksConfigurations>

<quickLinksConfiguration>


    <quickLinksConfigurations>
        <quickLinksConfiguration>
            <fileName>quicklinks.json</fileName>

...


            <default>true</default>

...


        </quickLinksConfiguration>

...


    </quickLinksConfigurations>

 

The metainfo.xml can have different quicklinks configuration as shown here for MapReduce2.
The
quickLinksConfigurations-dir is an optional field that tells Ambari Server where to load the quicklinks.json file. We can skip it if we want the service to use the default quicklinks directory.

<service>

Code Block
languagexml
themeEclipse
firstline1
linenumberstrue
<service>
    <name>MAPREDUCE2</name>

...


    <version>2.7.1.2.3</version>

...

… …


    <quickLinksConfigurations-dir>quicklinks-mapred</quickLinksConfigurations-dir>

...

<quickLinksConfigurations>

<quickLinksConfiguration>


    <quickLinksConfigurations>
        <quickLinksConfiguration>
            <fileName>quicklinks.json</fileName>

...


            <default>true</default>

...


        </quickLinksConfiguration>

...


    </quickLinksConfigurations>

 

Each quicklinks.json A quick link JSON file has two major sections, the general "configuration" section for determine the protocol (http HTTP vs httpsHTTPS), and a list of configurations for each quicklink.

 

the "links" section for meta information of each quicklink to be displayed on the Ambari web UI. The JSON file also includes a "name" section at the top that defines the name of the quicklinks JSON file that server uses for identification. 

Ambari web UI uses information provided in the "configuration" section to determine if the service is running against HTTP or HTTPS. The result is used to construct all quick link URLs defined in the "links" section.

Use YARN as an example, the following is what the quicklinks.json looks like# denotes comments
{

Code Block
languagetext
themeEclipse
firstline1
linenumberstrue
{
	"name": "default",

...


	"description": "default quick links configuration",

...


	"configuration":

...

#section for the UI to determine whether to use HTTP or HTTPS.

...

 {
		"protocol":

...

{

"type":"https", # type tells the UI which protocol to use if all checks meet. Use https_only or http_only with empty checks section to explicitly specify the type

"checks":[ # There can be more than one check needed.

{

 {
			# type tells the UI which protocol to use if all checks meet. 
            # Use https_only or http_only with empty checks section to explicitly specify the type
			"type":"https", 
			"checks":[ # There can be more than one check needed.
				{
					"property":"yarn.http.policy",

...


					# Desired section here either is a specific value for the property specified 
                    # Or whether the property value should exit or not_exist, blank or not_blank

...


					"desired":"HTTPS_ONLY",

...


					"site":"yarn-site"

...

}

]

},

 

#configuration for individual links


				}
			]
		},
		#configuration for individual links
		"links": [

...

{


			{
				"name": "resourcemanager_ui",

...


				"label": "ResourceManager UI",

...


				"requires_user_name": "false", #set this to true if UI should attach log in user name to the end of the quick link url

...


				"url": "%@://%@:%@",

...

"knox_url": "%@://%@:%@/gatway/default/yarn", #url template used for knox

...

"port":{

"http_property": "yarn.timeline-service.webapp.address", #use a property for the whole url if the service does not have a property for the port. Specify the regex so the url can be parsed for the port value.

"http_default_port": "8088",



				#section calculate the port numbe.
				"port":{
					#use a property for the whole url if the service does not have a property for the port. 
					#Specify the regex so the url can be parsed for the port value.
					"http_property": "yarn.timeline-service.webapp.address", 
                    "http_default_port": "8080",
					"https_property": "yarn.timeline-service.webapp.https.address",

...


					"https_default_port": "8090",

...


					"regex": "\\w*:(\\d+)",

...


					"site": "yarn-site"

...

}

},

{


				}
			},
			{
				"name": "resourcemanager_logs",

...


				"label": "ResourceManager logs",

...


				"requires_user_name": "false",

...


				"url": "%@://%@:%@/logs",

...

"knox_url": "%@://%@:%@/gatway/default/yarn/logs",

"template": "%@://%@:%@/logs",

...


				"port":{

...


					"http_property": "yarn.timeline-service.webapp.address",

...


					"http_default_port": "8088",

...


					"https_property": "yarn.timeline-service.webapp.https.address",

...


					"https_default_port": "8090",

...


					"regex": "\\w*:(\\d+)",

...


					"site": "yarn-site"

...

}

]

}


				}
			}
		]
	}
}

REST API

 

You can examine the quicklink information made available to the Ambari web UI by running the following REST API via a as an HTTP GET request.Ambari server right now only accepts GET request for quicklinks. Here is the response

REST API

Code Block
languagetext
themeEclipse
firstline1
linenumberstrue
/api/v1/stacks/[stack_name]versions/[stack_version]/services/[service_name]/quicklinks?QuickLinkInfo/default=true&fields=*

 

Response sent to the Ambari web UI.{

Code Block
languagetext
themeEclipse
firstline1
linenumberstrue
{
  "href" : "http://

...

localhost:8080/api/v1/stacks/HDP/versions/2.3/services/YARN/quicklinks?QuickLinkInfo/default=true&fields=*",

...


  "items" : [

...

{


    {
      "href" : "http://

...

localhost:8080/api/v1/stacks/HDP/versions/2.3/services/YARN/quicklinks/quicklinks.json",

...


      "QuickLinkInfo" :

...

 {
        "default" : true,

...


        "file_name" : "quicklinks.json",

...


        "service_name" : "YARN",

...


        "stack_name" : "HDP",

...


        "stack_version" : "2.3",

...


        "quicklink_data" :

...

 {
          "QuickLinksConfiguration" :

...

 {
            "description" : "default quick links configuration",

...


            "name" : "default",

...


            "configuration" :

...

 {
              "protocol" :

...

 {
                "type" : "https",

...


                "checks" :

...

{

 [
                  {
                    "property" : "yarn.http.policy",

...


                    "desired" : "HTTPS_ONLY",

...


                    "site" : "yarn-site"

...

}

]

},

"links" : [

{

"name" : "resourcemanager_ui",

"label" : "ResourceManager UI",

...


                  }
                ]
              },
              "links" : [
                {
                  "name" : "resourcemanager_jmx",
                  "label" : "ResourceManager JMX",
                  "url" : "%@://%@:%@

...

"template" : "%@://%@:%@",

"port" : {

...

/jmx",
                  "port" : {
                    "regex" : "\\w*:(\\d+)",

...


                    "site" : "yarn-site",

...


                    "http_property" : "yarn.timeline-service.webapp.address",

...


                    "http_default_port" : "8088",

...


                    "https_property" : "yarn.timeline-service.webapp.https.address",

...


                    "https_default_port" : "8090"

...

},


                  },
                  "removed" : false,

...

"requires_user_name" : "false",

"knox_url" : "%@://%@:%@/gatway/yarnui/yarn"

},

{

"name" : "resourcemanager_logs",

"label" : "ResourceManager logs",

...


                  "component_name" : "RESOURCEMANAGER",
                  "requires_user_name" : "false"
                },
                {
                  "name" : "resourcemanager_logs",
                  "label" : "ResourceManager logs",
                  "url" : "%@://%@:%@/logs",

...

"template" : "%@://%@:%@/logs",

"port" : {

...


                  "port" : {
                    "regex" : "\\w*:(\\d+)",

...


                    "site" : "yarn-site",

...


                    "http_property" : "yarn.timeline-service.webapp.address",

...


                    "http_default_port" : "8088",

...


                    "https_property" : "yarn.timeline-service.webapp.https.address",

...


                    "https_default_port" : "8090"

...

},


                  },
                  "removed" : false,

...

"requires_user_name" : "false",

"knox_url" : "%@://%@:%@/gatway/yarnui/yarn/logs"

},

{

"name" : "resourcemanager_jmx",

"label" : "ResourceManager JMX",

...


                  "component_name" : "RESOURCEMANAGER",
                  "requires_user_name" : "false"
                },
                {
                  "name" : "resourcemanager_ui",
                  "label" : "ResourceManager UI",
                  "url" : "%@://%@:%@

...

",

...

"template" : "%@://%@:%@/jmx",

"port" : {

...


                  "port" : {
                    "regex" : "\\w*:(\\d+)",

...


                    "site" : "yarn-site",

...


                    "http_property" : "yarn.

...

resourcemanager.webapp.address",

...


                    "http_default_port" : "8088",

...


                    "https_property" : "yarn.

...

resourcemanager.webapp.https.address",

...


                    "https_default_port" : "8090"

...

},


                  },
                  "removed" : false,

...

"requires_user_name" : "false",

"knox_url" : "%@://%@:%@/gatway/yarnui/yarn/jmx"

},

{

"name" : "thread_stacks",

"label" : "Thread Stacks",

...


                  "component_name" : "RESOURCEMANAGER",
                  "requires_user_name" : "false"
                },
                {
                  "name" : "thread_stacks",
                  "label" : "Thread Stacks",
                  "url" : "%@://%@:%@/stacks",

...

"template" : "%@://%@:%@/stacks",

"port" : {

...


                  "port" : {
                    "regex" : "\\w*:(\\d+)",

...


                    "site" : "yarn-site",

...


                    "http_property" : "yarn.timeline-service.webapp.address",

...


                    "http_default_port" : "8088",

...


                    "https_property" : "yarn.timeline-service.webapp.https.address",

...


                    "https_default_port" : "8090"

...

},


                  },
                  "removed" : false,

...

"knox_url" : "%@://%@:%@/gatway/yarnui/yarn/stacks"

}

]

}

}

}

}

}

]

}

Ambari Web UI

...


                  "component_name" : "RESOURCEMANAGER",
                  "requires_user_name" : "false"
                }
              ]
            }
          }
        }
      }
    }
  ]
}

Ambari Web UI

The changes for the stack driven quick links are hidden from the UI presentation. The quick links drop-down list behavior remains unchanged.