Skip to content

Instantly share code, notes, and snippets.

@Buttonwood
Forked from onefoursix/cm-list-services.py
Created June 13, 2019 02:19
Show Gist options
  • Save Buttonwood/8cd1ded817807cbd140c1dcb04425a22 to your computer and use it in GitHub Desktop.
Save Buttonwood/8cd1ded817807cbd140c1dcb04425a22 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
from cm_api.api_client import ApiResource
## ** CM Connection Settings ******************************
cm_host = "localhost"
cm_port = "7180"
cm_login = "admin"
cm_password = "admin"
cluster_name = "Cluster 1"
print "Connecting to Cloudera Manager at : http://" + cm_host + ":" + cm_port
api = ApiResource(server_host=cm_host, server_port=cm_port, username=cm_login, password=cm_password)
cluster = api.get_cluster(cluster_name)
for service in cluster.get_all_services():
print service.type + " Service " + "(" + service.displayName + ")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment