Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

API + namenode status

avatar

hi all

we want to verify the name nodes status from ambari by API ( namenode adtive/stand by under hdfs )

capture.png

is it possible to create API for that?

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor
5 REPLIES 5

avatar
Master Mentor

avatar
Master Mentor

@Michael Bronson

Example: Please check the "HAState" field value.

# curl -u admin:admin -H "X-Requested-By: ambari" -X GET "http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/host_components?HostRoles/component_name=NAMENODE&metrics/dfs/FSNamesystem/HAState=active"

.

Output:

{
  "href" : "http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/host_components?HostRoles/component_name=NAMENODE&metrics/dfs/FSNamesystem/HAState=active",
  "items" : [
    {
      "href" : "http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/hosts/hdfcluster1.example.com/host_components/NAMENODE",
      "HostRoles" : {
        "cluster_name" : "TestCluster",
        "component_name" : "NAMENODE",
        "host_name" : "hdfcluster1.example.com"
      },
      "host" : {
        "href" : "http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/hosts/hdfcluster1.example.com"
      },
      "metrics" : {
        "dfs" : {
          "FSNamesystem" : {
            "HAState" : "active"
          }
        }
      }
    }
  ]
}

.

avatar

@Jay what should be the HAState for the standby machine ?

Michael-Bronson

avatar
what we get is only that
 curl -u admin:admin -H "X-Requested-By: ambari" -X GET "http://name2:8080/api/v1/clusters/clu45/host_components?HostRoles/component_name=NAMENODE&metrics/dfs/FSNamesytem/HAState=standby"
{
  "href" : "http://name2:8080/api/v1/clusters/clu45/host_components?HostRoles/component_name=NAMENODE&metrics/dfs/FSNamesystem/HAState=standby",
  "items" : [ ]
Michael-Bronson

avatar
Master Mentor

@Michael Bronson

There is a Type in your URL. The spelling of "FSNamesytem" (should be "FSNamesystem") one character 's' is missing in the word.

So please try this:

# curl -u admin:admin -H "X-Requested-By: ambari" -X GET "http://name2:8080/api/v1/clusters/clu45/host_components?HostRoles/component_name=NAMENODE&metrics/dfs/FSNamesystem/HAState=standby

.