Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

API + namenode status

Solved Go to solution
Highlighted

API + namenode status

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

Accepted Solutions
Highlighted

Re: API + namenode status

Super Mentor
5 REPLIES 5
Highlighted

Re: API + namenode status

Super Mentor
Highlighted

Re: API + namenode status

Super 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"
          }
        }
      }
    }
  ]
}

.

Highlighted

Re: API + namenode status

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

Michael-Bronson
Highlighted

Re: API + namenode status

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
Highlighted

Re: API + namenode status

Super 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

.

Don't have an account?
Coming from Hortonworks? Activate your account here