def check_status(self):
    self.alert_msg = ''
    logger.info("checking clusters status")

    self.start_time = time.time()
    for cluster in Cluster.objects.filter(active=True).all():
      self.check_cluster_status(cluster)
    logger.info("spent %f seconds for updating clusters status",
        time.time() - self.start_time)
    if self.alert_msg:
      logger.warn('alert msg: %r' % self.alert_msg)
      self.mailer.send_email(subject = 'OWL cluster alert',
                             content = self.alert_msg,
                             to_email = self.options['to_email'])
    json.dump(self.last_status, open(STATUS_FILE_PATH, 'w'))
dataset/ETHPy150Open XiaoMi/minos/owl/alert/management/commands/alert.py/StatusChecker.check_status/original