Support Questions
Find answers, ask questions, and share your expertise

Detecting Configuration Change via Ambari Rest curl

Super Collaborator

Hi All, If we were to detect any configuration changes via rest calls to Ambari, what is the best approach? I have seen If there is an application that polls the URL at a frequent time interval and "remembers" the timestamp during every call and compares it to the next subsequent call, it can be done. But is there a different approach someone can suggest.


Re: Detecting Configuration Change via Ambari Rest curl

@Arun A K

At regular interval we can compare the Ambari Blueprint to see what changes are made by comparing two results. Following approach can be integrated inside a shell script (cronjob) to poll the config changes at some regular interval and to find the "diff" between current and last output files "/tmp/cluster-`date +'%Y%m%d%H%M'`.txt"


curl  -o "/tmp/cluster-`date +'%Y%m%d%H%M'`.txt" -u admin:admin -H "X-Requested-By: ambari"  -X GET http://jss1:8080/api/v1/clusters/JoyCluster?format=blueprint 

Re: Detecting Configuration Change via Ambari Rest curl


@Arun A K - You may want to check the output of below REST call

curl -u admin:admin -i -H 'X-Requested-By: ambari' -X GET http://$server:8080/api/v1/clusters/$clustername/configurations/service_config_versions

This would list the service config versions of all services. At any time you make the above call, it would provide the complete history of service config changes. Some fields that could be of interest are mentioned in below post

Hope this helps!