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.

Ambari API maintenance mode for host

Highlighted

Ambari API maintenance mode for host

New Contributor

Hello 

 

Anybody knows how can i turn on/off maintenance mode for host via API ? 

3 REPLIES 3

Re: Ambari API maintenance mode for host

Super Mentor

@stryjz 

In order to turn ON maintenance mode for Host "abcd.example.com"

# curl -iLvk -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Turn On Maintenance Mode for host","query":"Hosts/host_name.in(abcd.example.com)"},"Body":{"Hosts":{"maintenance_state":"ON"}}}' ttp://ambariserver.example.com:8080/api/v1/clusters/DemoCluster/hosts


In order to turn OFF maintenance mode for Host "abcd.example.com"

# curl -iLvk -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Turn On Maintenance Mode for host","query":"Hosts/host_name.in(abcd.example.com)"},"Body":{"Hosts":{"maintenance_state":"OFF"}}}'  ttp://ambariserver.example.com:8080/api/v1/clusters/DemoCluster/hosts

 

.

Please change the Cluster Name "DemoCluster" and hostnames of ambari server and intended host , credentials in the above above example API calls.

Highlighted

Re: Ambari API maintenance mode for host

New Contributor
Thank you, it works like a charm
Can tell me where i can find full API documentation ?

Kamil
Highlighted

Re: Ambari API maintenance mode for host

Super Mentor

@stryjz 

Most the API calls will remain same/similar in Ambari 2.7 and previous releases.

Ambari 2.7 has a cool new feature where it is integrated with Swagger and you can try and explore all the REST APIs.

Steps to use Swagger

For more information on this please refer to : https://community.cloudera.com/t5/Community-Articles/How-To-Use-Swagger-with-Ambari-Explore-Ambari-R...

 


If your question is answered then, Please make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

 

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