- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
how to get status of components on specific datanode ( worker machine )
- Labels:
-
Apache Ambari
-
Apache Hadoop
Created on ‎01-08-2018 07:38 PM - edited ‎08-18-2019 01:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to get status of components by REST API on specific datanode ( worker machine )
each datanode worker has the following components
REST API should return the status only for the components as describe din the picture per worker machine
second
is it possible to get by REST API the status of datanode alive ?
Created ‎01-08-2018 08:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In order to get the State of Each DataNode on different Nodes, you can use the following API call:
Syntax:
# curl -H "X-Requested-By: ambari" -u admin:admin -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/services/HDFS/components/DATANODE?fields=host...
.
Example:
# curl -H "X-Requested-By: ambari" -u admin:admin -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fiel... { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fields=host_components/HostRoles/host_name,host_components/HostRoles/state", "ServiceComponentInfo" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "service_name" : "HDFS" }, "host_components" : [ { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25101.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25101.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25102.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25102.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25103.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25103.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25104.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25104.example.com", "state" : "STARTED" } } ]
Created ‎01-08-2018 08:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In order to get the State of Each DataNode on different Nodes, you can use the following API call:
Syntax:
# curl -H "X-Requested-By: ambari" -u admin:admin -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/services/HDFS/components/DATANODE?fields=host...
.
Example:
# curl -H "X-Requested-By: ambari" -u admin:admin -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fiel... { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fields=host_components/HostRoles/host_name,host_components/HostRoles/state", "ServiceComponentInfo" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "service_name" : "HDFS" }, "host_components" : [ { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25101.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25101.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25102.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25102.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25103.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25103.example.com", "state" : "STARTED" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25104.example.com/host_components/DATANODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "DATANODE", "host_name" : "amb25104.example.com", "state" : "STARTED" } } ]
Created ‎01-08-2018 09:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And if you add "grep -A 1 host_name" in the above API call then you can gt the output as following:
curl -i -H "X-Requested-By: ambari" -u admin:admin -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fiel... | grep -A 1 host_name "ServiceComponentInfo" : { -- "host_name" : "amb25101.example.com", "state" : "STARTED" -- "host_name" : "amb25102.example.com", "state" : "STARTED" -- "host_name" : "amb25103.example.com", "state" : "STARTED" -- "host_name" : "amb25104.example.com", "state" : "STARTED"<br>
.
Similarly you can Grep for Non Running DataNode from the above Output.
Created ‎01-08-2018 09:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Jay what about <matrix monitor> and <YARN> , meanwhile we see only the component - DATANODE
Created ‎01-08-2018 09:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For "Metrics Monitor" status you can alter the API call as following:
# curl -i -H "X-Requested-By: ambari" -u admin:admin -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/AMBARI_METRICS/components/MET... | grep -A 1 host_name
For Yarn Resources like "NODEMANAGER" you can do it like: (Same logic you can apply for RESOURCEMANAGER, APP_TIMELINE_SERVER)
# curl -i -H "X-Requested-By: ambari" -u admin:admin -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/YARN/components/NODEMANAGER?f... | grep -A 1 host_name
..
