Support Questions

Find answers, ask questions, and share your expertise

API + show component status

avatar

why API not capture the real status of component

for example by this API ( example down ) we capture the status of APP_TIMELINE_SERVER

component and its show the component started ( "state":"STARTED", )

but in fact the real status from ambari is STOP

59387-capture.png

curl -u $USER:$PASSWORD -H "X-Requested-By: ambari" -X GET http://localhost:8080/api/v1/clusters/HDP/components/APP_TIMELINE_SERVER
{
  "href" : "http://localhost:8080/api/v1/clusters/HDP/components/APP_TIMELINE_SERVER",
  "ServiceComponentInfo" : {
    "category" : "MASTER",
    "cluster_name" : "HDP",
    "component_name" : "APP_TIMELINE_SERVER",
    "display_name" : "App Timeline Server",
    "init_count" : 0,
    "install_failed_count" : 0,
    "installed_count" : 1,
    "recovery_enabled" : "true",
    "service_name" : "YARN",
    "started_count" : 0,
    "state" : "STARTED",
    "total_count" : 1,
    "unknown_count" : 0
  },
  "host_components" : [
    {
      "href" : "http://localhost:8080/api/v1/clusters/HDP/hosts/master01.sys67.com/host_components/APP_TIMELINE_SERVER",
      "HostRoles" : {
        "cluster_name" : "HDP",
        "component_name" : "APP_TIMELINE_SERVER",
        "host_name" : "master01.sys67.com"
      }
    }
  ]

so how it can be?

why API show different the Ambari GUI?

or maybe what is wrong with my API syntax ?

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Super Guru

@Michael Bronson,

I'm not sure why the above API is returning different status. It may be a bug. You can use this API to get the correct status

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components/A...

Replace the place holders. {host-name} should be replaced with the hostname of the APP TIMELINE SERVER.

Thanks,

Aditya

View solution in original post

3 REPLIES 3

avatar
Super Guru

@Michael Bronson,

I'm not sure why the above API is returning different status. It may be a bug. You can use this API to get the correct status

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components/A...

Replace the place holders. {host-name} should be replaced with the hostname of the APP TIMELINE SERVER.

Thanks,

Aditya

avatar

what need to put in - {host-name} , ( we already set the hostname in ambari-host )

Michael-Bronson

avatar
Super Guru

@Michael Bronson,

Replace {host-name} with the host name where App timeline server is installed. From your output in the question looks like App time line server is installed on "master01.sys67.com". So you can try this url

curl -u $USER:$PASSWORD -X GET -H "X-Requested-By: ambari" http://localhost:8080/api/v1/clusters/HDP/hosts/master01.sys67.com/host_components/APP_TIMELINE_SERV...

Thanks,

Aditya