Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ambari REST API list components with Stale configs not showing service_name

avatar
Rising Star

I would like to list all components with stale configs and I would like to have the service_name in the response. I tried several methods, like the one below, and all I get is the component but not the service it belongs to. Any idea how to get this please?

I am using Ambari 2.1

curl -u admin:admin http://host_name:8080/api/v1/clusters/test_cluster/host_components?HostRoles/stale_configs=true

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Theyaa Matti

Can you try putting the URL inside Quotation Mark?

As the URL consist of (&)

Example:

curl -u admin:admin -H "X-Requested-By:ambari" -X GET "http://172.26.102.21:8080/api/v1/clusters/hdp234/host_components?HostRoles/stale_configs=false&fields=HostRoles/service_name

View solution in original post

14 REPLIES 14

avatar
Master Mentor

avatar
Rising Star

Tried both methods and same results, no service_name 😞

avatar
Master Mentor

@Theyaa Matti

Which ambari version are you using? Also can you please share the exact command and response output here?

I just now tried the same on Ambaei 2.4.0.0 and can se this thing working fine.

http://localhost:8080/api/v1/clusters/Sandbox/host_components?HostRoles/stale_configs=true&fields=Ho...

15271-service-name.png

.

avatar
Master Mentor

@Theyaa Matti

Currently i do not have Ambari 2.1 setup ready to test the same .... but i guess it should be working as expected or else it might be enhanced to show the service name in later version of ambari 2.1

avatar
Rising Star

So, I am getting mixed results. When I use the browser, like what you did above, I get the service_name. But when I use curl on command line, I do NOT get the the service_name. Which makes me more confused.

I am using Ambari 2.1

avatar
Rising Star

I upgraded to Ambari 2.4.2 and the same issue. In order to replicate the issue, you need to call that url using curl and not the browser. Something like:

curl -u admin:admin -H "X-Requested-By:ambari" -X GET http://localhost:8080/api/v1/clusters/Sandbox/host_components?HostRoles/stale_configs=true&fields=Ho...

avatar
Master Mentor

@Theyaa Matti

Can you try putting the URL inside Quotation Mark?

As the URL consist of (&)

Example:

curl -u admin:admin -H "X-Requested-By:ambari" -X GET "http://172.26.102.21:8080/api/v1/clusters/hdp234/host_components?HostRoles/stale_configs=false&fields=HostRoles/service_name

.

avatar
Rising Star

I tried your suggestion and here is what I get:

"HostRoles" : {

"cluster_name" : "test_cluster",

"component_name" : "WEBHCAT_SERVER",

"host_name" : "hostname",

"stale_configs" : true

}

So, no service_name 😞