Support Questions

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

how to check which services/component are in maintenance mode

avatar

we run the follwing curl in order to check which services/component are in maintenance mode

curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://localhost:8080/api/v1/clusters/sys76/services?ServiceInfo/maintenance_state=OFF

as we can see all zookeeper are in maintenance mode

65419-capture.png

but the output from API still show - "maintenance_state" : "OFF"

why ? - what its wrong here ?

example

      "href" : "http://localhost:8080/api/v1/clusters/sys76/services/ZOOKEEPER",
      "ServiceInfo" : {
        "cluster_name" : "sys76",
        "maintenance_state" : "OFF",
        "service_name" : "ZOOKEEPER"
      }
    }
  ]
Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Super Guru

@Michael Bronson,

You can use this API to check maintenance mode of components in a particular host

To get maintenance_state of all components

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?fields=HostRoles/mainte...

To get components which have maintenance mode ON

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...

To get components which have maintenance mode OFF

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...

Note: Replace the hostname with the original hostname in the curl call

.

-Aditya

View solution in original post

7 REPLIES 7

avatar
Super Collaborator

The is the correct way to check for Maintenance Mode being enabled. Which version of Ambari are you running? When I try this locally, the correct value for `maintenance_state` is reflected.

Also - you're putting the ZooKeeper service itself into MM, right? Putting individual hosts/components into MM won't reflect here.

avatar

so in that case can we capture the individual hosts/components that are in MM?

Michael-Bronson

avatar

we have ambari version - 2.6.1.0

Michael-Bronson

avatar
Super Collaborator

Yes, you can - the above calls can capture it on a host/component basis.

avatar
Super Guru

@Michael Bronson,

You can use this API to check maintenance mode of components in a particular host

To get maintenance_state of all components

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?fields=HostRoles/mainte...

To get components which have maintenance mode ON

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...

To get components which have maintenance mode OFF

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://localhost:8080/api/v1/clusters/sys76/hosts/{hostname}/host_components?HostRoles/maintenance_s...

Note: Replace the hostname with the original hostname in the curl call

.

-Aditya

avatar

@Aditya

do you think we must check that no maintenance mode in component before HDP upgrade ?

Michael-Bronson

avatar
Super Guru

@Michael Bronson,

I think it is a good idea to check that no component is in maintenance mode. Ambari recommends that all the services must be up and running before upgrade and all the service checks should pass before the upgrade.