--- title: "Using Ambari REST APIs" slug: "hadoop-vpc-9" updated: 2026-09-17T09:17:45Z published: 2026-09-17T09:17:45Z canonical: "guide.ncloud-docs.com/hadoop-vpc-9" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Using Ambari REST APIs Available in VPC Apache Ambari provides easy Web UI and REST API, simplifying Hadoop cluster management and monitoring. This guide describes how to use Ambari REST API. For more information about Ambari REST API, see [Ambari API reference v1](https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md). ## Compose Ambari REST API's URI Compose Ambari REST API's URI as follows: - `AMBARI-ADDRESS`: Enter the domain address assigned to the cluster. - `CLUSTER-NAME`: Name of the cluster (make sure to check the cluster's name as it is case-sensitive). ``` http://:8080/api/v1/clusters/ ``` ## Request Ambari REST API Use curl to send a GET request to Ambari REST API. - `example`/`pass123!@#`: Ambari's admin account ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark" ``` Run REST API using the above cluster information, and a JSON document like the following one is returned: ``` # Run curl curl -u obj -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark" { "href" : "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark", "Clusters" : { "cluster_id" : 2, "cluster_name" : "SPARK", "health_report" : { "Host/stale_config" : 0, "Host/maintenance_state" : 0, "Host/host_state/HEALTHY" : 3, "Host/host_state/UNHEALTHY" : 0, "Host/host_state/HEARTBEAT_LOST" : 0, "Host/host_state/INIT" : 0, "Host/host_status/HEALTHY" : 3, "Host/host_status/UNHEALTHY" : 0, "Host/host_status/UNKNOWN" : 0, "Host/host_status/ALERT" : 0 .... ``` ## Parse return value using the jq command You can use [jq](https://stedolan.github.io/jq/) to filter or convert certain parts of the JSON document returned as a REST API result. Before proceeding with the task, run the following commands to install jq. ``` $ sudo yum install -y epel-release $ sudo -s $ yum -y install jq # Install jq $ jq --help # Confirm that jq is installed ``` Below is an example of filtering only the `health_report` information from the clusters in JSON results using jq. ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark" | jq ".Clusters.health_report" { "Host/stale_config": 0, "Host/maintenance_state": 0, "Host/host_state/HEALTHY": 4, "Host/host_state/UNHEALTHY": 0, "Host/host_state/HEARTBEAT_LOST": 0, "Host/host_state/INIT": 0, "Host/host_status/HEALTHY": 4, "Host/host_status/UNHEALTHY": 0, "Host/host_status/UNKNOWN": 0, "Host/host_status/ALERT": 0 } ``` ## Examples ### Get the fully qualified domain name (FQDN) of all nodes ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark/hosts" | jq ".items[].Hosts.host_name" ``` ### Get the FQDN of master node ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark/services/HDFS/components/NAMENODE" | jq ".host_components[].HostRoles.host_name" ``` ### Get the FQDN of worker node ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark/services/HDFS/components/DATANODE" | jq ".host_components[].HostRoles.host_name" ``` ### Get the internal IP address of a cluster node To find the IP address, you need the internal FQDN of the cluster node. First, send an Ambari query to find the FQDN of the host node, then send an Ambari query again to find the IP address of each host. ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark/hosts/d-002-test-spark-36m-hd" | jq ".Hosts.ip" ``` ### Get default.FS Cloud Hadoop uses Object Storage as the default storage, and the result of the subject API is returned as hdfs://. ``` curl -u "example:pass123!@#" -G "http://pub-68u67.hadoop.ntruss.com:8080/api/v1/clusters/test-spark/configurations/service_config_versions?service_name=HDFS&service_config_version=1" | jq '.items[].configurations[].properties["fs.defaultFS"] | select(. != null)' ```