def check_hbase_cluster_status(self, cluster):
    job = cluster.jobs["master"]
    if job.running_tasks_count < 1:
      job.last_status = Status.ERROR
      job.last_message = "No running masters!"
    else:
      active = 0
      for task in job.running_tasks.itervalues():
        if self.is_master_active(task):
          # update cluster entry
          cluster.entry = '%s:%d' % (task.host, task.port)
          version = self.get_latest_metric(task,
                                           'hadoop:service=HBase,name=Info',
                                           'version')
          revision = self.get_latest_metric(task,
                                           'hadoop:service=HBase,name=Info',
                                           'revision')
          cluster.version = '%s, r%s' % (version, revision)
          active += 1
      if active > 1:
        job.last_status = Status.ERROR
        job.last_message = "Too many active masters!"
      elif active < 1:
        job.last_status = Status.ERROR
        job.last_message = "No active masters!"
      elif job.running_tasks_count < 2:
        # TODO: Now it always reports warning as backup master doesn't run a http
        # server before it acquires zk lock. Comment this out and would change
        # master's startup workflow.
        #job.last_status = Status.WARN
        #job.last_message = "Less than 2 running masters, no HA guarantee"
        pass

    job = cluster.jobs["regionserver"]
    if job.running_tasks_count < 3:
      job.last_status = Status.ERROR
      job.last_message = "Too few running regionservers!"
    cluster.last_status = max([job.last_status for job in cluster.jobs.itervalues()])
dataset/ETHPy150Open XiaoMi/minos/owl/alert/management/commands/alert.py/StatusChecker.check_hbase_cluster_status/original