Cloudera Manager API Client

Automate your Hadoop management


Project maintained by cloudera

Background: Getting Cloudera Manager

Cloudera Manager is a comple/te management solution for your Hadoop clusters. Some of the cool things you can do with Cloudera Manager:

The Cloudera Manager Enterprise Edition offers even more:

You can download Cloudera Manager Free Edition from Cloudera's website.

Cloudera Manager API Client

Since version 4.0, Cloudera Manager exposes the its functionality through an HTTP API. The API is available in both the Free Edition and the Enterprise Edition.

This repository hosts a set of client-side utilities for communicating with the Cloudera Manager API.

Python

To install the Python API client:

$ git clone git://github.com/cloudera/cm_api.git
$ cd cm_api/python
$ python setup.py install

A quick example:

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
>>> cm_host = "manager.mydomain.com"
>>> api = ApiResource(cm_host, username="admin", password="admin")
>>> for c in api.get_all_clusters(): print c.name
... 
Cluster 1 - CDH3
Cluster 2 - CDH4

Java

Add to your pom.xml:

<project>
  <repositories>
    <repository>
      <id>cdh.repo</id>
      <url>https://repository.cloudera.com/content/groups/cloudera-repos</url>
      <name>Cloudera Repository</name>
    </repository>
    …
  </repositories>
  <dependencies>
    <dependency>
      <groupId>com.cloudera.api</groupId>
      <artifactId>cloudera-manager-api</artifactId>
      <version>4.5.2</version>      <!-- Or the CM version you work with -->
    </dependency>
    …
  </dependencies>
  ...
</project>

A quick example:

RootResourceV3 apiRoot = new ClouderaManagerClientBuilder()
            .withHost("cm.cloudera.com")
            .withUsernamePassword("admin", "admin")
            .build()
            .getRootV3();
ApiClusterList clusters = apiRoot.getClustersResource()
            .readClusters(DataView.SUMMARY);

Resources

License

This repository is licensed under Apache License v2. Contributions welcome. Please post any questions to the user mailing list.