Versions Compared

Key

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

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.

Design

By default, the JSON file is called quicklinks.json and is located in the quicklinks directory under the service root directory. For example, for Oozie, the file is OOZIE/quicklinks/quicklinks.json. You can also name the file differently as well as put it in a custom directory under the service root directory.


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

<services>

<service>

<name>YARN</name>

<version>2.7.1.2.3</version>

… …

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

<name>MAPREDUCE2</name>

<version>2.7.1.2.3</version>

… …

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

<quickLinksConfigurations>

<quickLinksConfiguration>

<fileName>quicklinks.json</fileName>

<default>true</default>

</quickLinksConfiguration>

</quickLinksConfigurations>

 

Each quicklinks.json file has two major sections, the general configuration for determine the protocol (http vs https), and a list of configurations for each quicklink.

 

Use YARN as an example, the following is what the quicklinks.json looks like


# denotes comments
{

"name": "default",

"description": "default quick links configuration",

"configuration": {

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

#the result of it will be used for all the quicklinks defined in the links section.
"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.

{

"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

"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

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

#section calculate the port numbe.

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

"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 HTTP GET request.

Ambari server right now only accepts GET request for quicklinks. Here is the response sent to the Ambari web UI.
{

"href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/services/YARN/quicklinks?QuickLinkInfo/default=true&fields=*",

"items" : [

{

"href" : "http://c6401.ambari.apache.org: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",

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

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

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

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

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

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

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

"template" : "%@://%@:%@/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/jmx"

},

{

"name" : "thread_stacks",

"label" : "Thread Stacks",

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

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

"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

Ambari web UI loads quicklinks configurations when user clicks on a service to display its summary tab.