Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Code Block
    languagepython
    titleShow all clusters in Ambari
    firstline1
    linenumberstrue
    all_clusters = client.get_all_clusters()
    print all_clusters.to_json_dict()
    print all_clusters
  2. Code Block
    languagepython
    titleShow all hosts in Ambari
    firstline1
    linenumberstrue
    all_hosts = client.get_all_hosts()
    print all_hosts
    print all_hosts.to_json_dict()
    print"\n"

Get metrics

  1. Code Block
    languagepython
    titleget cpu-metrics of service component TASKTRACKER
    firstline1
    linenumberstrue
    mr = mycluster.get_service("MAPREDUCE")
    mr_comp1 = mr.get_service_component('TASKTRACKER')
    metric_json = mr_comp1.get_metrics()
    print metric_json["metrics"]["cpu"]
    print"\n"
  2. Code Block
    languagepython
    titleget cpu-metrics from a host which has component NAMENODE
    firstline1
    linenumberstrue
    host1 = mycluster.get_host('host1')
    nn = host1.get_host_component("NAMENODE")
    metric_json = nn.get_metrics()
    print metric_json["metrics"]["cpu"]
    print"\n"

Create & configure cluster

...