Created 01-21-2019 05:29 AM
hi all
we want to verify the name nodes status from ambari by API ( namenode adtive/stand by under hdfs )
is it possible to create API for that?
Created 01-21-2019 05:54 AM
You can make use of the Ambari API call:
http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/host_components?HostRoles/component_...
Created 01-21-2019 05:54 AM
You can make use of the Ambari API call:
http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/host_components?HostRoles/component_...
Created 01-21-2019 05:57 AM
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"
}
}
}
}
]
}
Created 01-21-2019 06:04 AM
@Jay what should be the HAState for the standby machine ?
Created 01-21-2019 06:12 AM
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" : [ ]
Created 01-21-2019 09:53 AM
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
.