Cloudera Manager API
The Cloudera Manager API provides configuration and service lifecycle management, service health information and metrics, and allows you to configure Cloudera Manager itself.
The Cloudera Manager API is served on the same host and port as the Cloudera Manager Admin Console, and does not require an extra process or extra configuration. The API supports HTTP Basic Authentication, accepting the same users and credentials as the Cloudera Manager Admin Console.
You can also access the Cloudera Manager Swagger API user interface from the Cloudera Manager Admin Console. Go to to open Swagger.
API Documentation Resources
- Quick Start
- Python Client (deprecated)
- Python Client (Swagger-based)
- Java Client (Swagger-based)
Obtaining Configuration Files
- Obtain the list of a service's
roles:
http://cm_server_host:7180/api/v40/clusters/clusterName/services/serviceName/roles
- Obtain the list of configuration files a process is
using:
http://cm_server_host:7180/api/v40/clusters/clusterName/services/serviceName/roles/roleName/process
- Obtain the content of any particular
file:
http://cm_server_host:7180/api/v40/clusters/clusterName/services/serviceName/roles/roleName/process/ configFiles/configFileName
For example:http://cm_server_host:7180/api/v40/clusters/Cluster%201/services/OOZIE-1/roles/ OOZIE-1-OOZIE_SERVER-e121641328fcb107999f2b5fd856880d/process/configFiles/oozie-site.xml
Retrieving Service and Host Properties
To update a service property using the Cloudera Manager APIs, you'll
need to know the name of the property, not just the display name. If you
know the property's display name but not the property name itself,
retrieve the documentation by requesting any configuration object with
the query string
view=FULL
appended to the URL. For
example:http://cm_server_host:7180/api/v40/clusters/Cluster%201/services/service_name/config?view=FULL
Search the results for the display name of the desired property. For
example, a search for the display name HDFS Service Environment
Advanced Configuration Snippet (Safety Valve) shows that the
corresponding property name is
hdfs_service_env_safety_valve
:{ "name" : "hdfs_service_env_safety_valve", "require" : false, "displayName" : "HDFS Service Environment Advanced Configuration Snippet (Safety Valve)", "description" : "For advanced use onlyu, key/value pairs (one on each line) to be inserted into a roles environment. Applies to configurations of all roles in this service except client configuration.", "relatedName" : "", "validationState" : "OK" }
http://cm_server_host:7180/api/v40/hosts
This should return host objects of the form:
{ "hostId" : "2c2e951c-aaf2-4780-a69f-0382181f1821", "ipAddress" : "10.30.195.116", "hostname" : "cm_server_host", "rackId" : "/default", "hostUrl" : "http://cm_server_host:7180/cmf/hostRedirect/2c2e951c-adf2-4780-a69f-0382181f1821", "maintenanceMode" : false, "maintenanceOwners" : [ ], "commissionState" : "COMMISSIONED", "numCores" : 4, "totalPhysMemBytes" : 10371174400 }Then obtain the host properties by including one of the returned host IDs in the URL:
http://cm_server_host:7180/api/v40/hosts/2c2e951c-adf2-4780-a69f-0382181f1821?view=FULL