Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Detecting Configuration Change via Ambari Rest curl

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 https://cwiki.apache.org/confluence/display/AMBARI/Service+Config+Versions+API+usage 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.

2 REPLIES 2
Highlighted

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"

Example:

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

Contributor

@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

https://community.hortonworks.com/questions/45211/how-to-extract-configuration-changes-from-ambari.h...

Hope this helps!

Don't have an account?
Coming from Hortonworks? Activate your account here