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.

how to check which services/component are in maintenance mode

Solved Go to solution

how to check which services/component are in maintenance mode

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

Accepted Solutions

Re: how to check which services/component are in maintenance mode

@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

7 REPLIES 7

Re: how to check which services/component are in maintenance mode

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.

Re: how to check which services/component are in maintenance mode

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

Michael-Bronson

Re: how to check which services/component are in maintenance mode

we have ambari version - 2.6.1.0

Michael-Bronson

Re: how to check which services/component are in maintenance mode

Super Collaborator

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

Re: how to check which services/component are in maintenance mode

@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

Re: how to check which services/component are in maintenance mode

@Aditya

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

Michael-Bronson

Re: how to check which services/component are in maintenance mode

@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.