Created 05-08-2017 04:13 PM
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
Created 05-10-2017 02:03 PM
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
Created 05-08-2017 05:13 PM
Have you tried the following approach?
http://erie1.example.com:8080/api/v1/clusters/ClusterDemo/host_components?HostRoles/stale_configs=tr...
.
And also a bit more extended format as following:
http://erie1.example.com:8080/api/v1/clusters/ClusterDemo/host_components?HostRoles/stale_configs=tr...
.
Created 05-09-2017 05:45 PM
Tried both methods and same results, no service_name 😞
Created on 05-09-2017 06:10 PM - edited 08-17-2019 06:46 PM
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.
Created 05-09-2017 06:12 PM
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
Created 05-09-2017 06:37 PM
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
Created 05-10-2017 01:56 PM
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...
Created 05-10-2017 02:02 PM
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
Created 05-09-2017 04:32 AM
Created 05-09-2017 05:45 PM
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 😞
Created 05-09-2017 06:32 PM
Can you try this
http://172.26.100.103:8080/api/v1/clusters/hdp253/host_components?HostRoles/stale_configs=false&fiel...
see if you are able to list all service names, if yes, then change the value for "stale_configs=true" and rerun it like this
http://172.26.100.103:8080/api/v1/clusters/hdp253/host_components?HostRoles/stale_configs=true&field...
I am using HDP 2.6 and Ambari 2.5, works for me.
Here is the sample output:
{ "href" : "http://172.26.100.103:8080/api/v1/clusters/hdp253/host_components?HostRoles/stale_configs=false&fields=HostRoles/service_name", "items" : [ { "href" : "http://172.26.100.103:8080/api/v1/clusters/hdp253/hosts/xlnode-1.h.c/host_components/ACTIVITY_ANALYZER", "HostRoles" : { "cluster_name" : "hdp253", "component_name" : "ACTIVITY_ANALYZER", "host_name" : "xlnode-1.h.c", "service_name" : "SMARTSENSE", "stale_configs" : false }, "host" : { "href" : "http://172.26.100.103:8080/api/v1/clusters/hdp253/hosts/xlnode-1.h.c" } },
Created 05-09-2017 07:46 PM
Tried this with Ambari 2.2, of course I am checking for non-stale configs here, but it does show the service_name. You should upgrade your Ambari version, its not a major version.
http://172.26.102.21:8080/api/v1/clusters/hdp234/host_components?HostRoles/stale_configs=false&field...
Output
{ "href" : "http://172.26.102.21:8080/api/v1/clusters/hdp234/host_components?HostRoles/stale_configs=false&fields=HostRoles/service_name", "items" : [ { "href" : "http://172.26.102.21:8080/api/v1/clusters/hdp234/hosts/xlnode-234.h.c/host_components/APP_TIMELINE_SERVER", "HostRoles" : { "cluster_name" : "hdp234", "component_name" : "APP_TIMELINE_SERVER", "host_name" : "xlnode-234.h.c", "service_name" : "YARN", "stale_configs" : false }, "host" : { "href" : "http://172.26.102.21:8080/api/v1/clusters/hdp234/hosts/xlnode-234.h.c" } }, { "href" : "http://172.26.102.21:8080/api/v1/clusters/hdp234/hosts/xlnode-234.h.c/host_components/DATANODE", "HostRoles" : { "cluster_name" : "hdp234", "component_name" : "DATANODE", "host_name" : "xlnode-234.h.c", "service_name" : "HDFS", "stale_configs" : false }, "host" : { "href" : "http://172.26.102.21:8080/api/v1/clusters/hdp234/hosts/xlnode-234.h.c" } }, .... ... ..
Created 05-10-2017 01:55 PM
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://172.26.102.21:8080/api/v1/clusters/hdp234/host_components?HostRoles/stale_configs=false&field...
Created 05-10-2017 02:03 PM
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
Created 05-10-2017 03:17 PM
As simple as adding quotes!