Skip to content
Latest commit 13dc996 Mar 10, 2016 @hermancc hermancc [api] OPSAPS-32658. Support pools refresh starting v6
Since it's actually been around for a while.

(cherry picked from commit ff09be867c01827d465eb8e8b3075245493aac90)
(cherry picked from commit 8846594073fe12823afb3ef17757dd8cc823debd)

Welcome to Cloudera Manager API Client!

Python Client

The python source is in the python directory. The Python client comes with a cm_api Python client module, and examples on performing certain Hadoop cluster administrative tasks using the Python client.

Getting Started

Here is a short snippet on using the cm_api Python client:

Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from cm_api.api_client import ApiResource
>>> api = ApiResource('', 7180, 'admin', 'admin')
>>> for h in api.get_all_hosts():
...   print h.hostname

Another example: getting all the services in a cluster:

>>> for c in api.get_all_clusters():
...   print
Cluster 1 - CDH4
>>> for s in api.get_cluster('Cluster 1 - CDH4').get_all_services():
...  print


After installing the cm_api Python package, you can use the API shell cmps (CM Python Shell):

$ cmps -H <host> --user admin --password admin
Welcome to the Cloudera Manager Console
Select a cluster using 'show clusters' and 'use'
cloudera> show clusters
| Cluster 1 - CDH4 |
| Cluster 2 - CDH3 |

Please see the file for more.

Example Scripts

You can find example scripts in the python/examples directory.

  • --- Useful for heterogenous hardware environment. It sets the configuration on the roles running on a given set of hosts.
Something went wrong with that request. Please try again.