def check_health(self): imp_map = {'OK': 'GREEN', 'WARNING': 'YELLOW', 'CRITICAL': 'RED'} other_map = {'OK': 'GREEN'} color_counter = collections.Counter() important_services = self.get_important_services() for alert in self.provider.get_alerts_data(self.service): alert_summary = alert.get('state', 'UNKNOWN') if self.service in important_services: target = imp_map.get(alert_summary, 'RED') else: target = other_map.get(alert_summary, 'YELLOW') color_counter[target] += 1 if color_counter['RED'] > 0 and color_counter['YELLOW'] > 0: raise health_check_base.RedHealthError( _("Ambari Monitor has responded that cluster has " "%(red)d critical and %(yellow)d warning alert(s)") % {'red': color_counter['RED'], 'yellow': color_counter['YELLOW']}) elif color_counter['RED'] > 0: raise health_check_base.RedHealthError( _("Ambari Monitor has responded that cluster has " "%(red)d critical alert(s)") % {'red': color_counter['RED']}) elif color_counter['YELLOW'] > 0: raise health_check_base.YellowHealthError( _("Ambari Monitor has responded that cluster " "has %d warning alert(s)") % color_counter['YELLOW']) return _("No alerts found")
def check_health(self): important_services = self.provider.get_important_services() observed_data = self.provider.get_health_status(self.service) imp_map = {'BAD': 'red', 'CONCERNING': 'yellow', 'GOOD': 'green'} summary = observed_data['summary'] checks = observed_data.get('checks', []) failed_checks = [] for check in checks: if check['summary'] != 'GOOD': failed_checks.append('%(name)s - %(summary)s state' % { 'name': check['name'], 'summary': check['summary'] }) additional_info = None if failed_checks: additional_info = _("The following checks did not pass: %s" ) % ",".join(failed_checks) if self.service in important_services: overall = imp_map.get(summary, 'red') else: overall = 'green' if summary != 'GOOD': overall = 'yellow' msg = _("Cloudera Manager has responded that service is in " "the %s state") % summary if additional_info: msg = _("%(problem)s. %(description)s") % { 'problem': msg, 'description': additional_info } if overall == 'red': raise health_check_base.RedHealthError(msg) elif overall == 'yellow': raise health_check_base.YellowHealthError(msg) return msg
def check_health(self): instances = self.cluster_context.get_instances( node_process=management.ZOOKEEPER) active_count = 0 for instance in instances: if self._is_zookeeper_running(instance): active_count += 1 if active_count == 0: raise health_check_base.RedHealthError(_( "ZooKeeper is not in running state")) if active_count < len(instances): raise health_check_base.YellowHealthError(_( "Some ZooKeeper processes are not in running state")) return _("ZooKeeper is in running state")
def check_health(self): instances = self.cluster_context.get_instances( node_process=self.process) active_count = 0 for instance in instances: status = self.process.status(instance) if status == np.Status.RUNNING: active_count += 1 if active_count == 0: if self.process.ui_name in self.IMPORTANT_PROCESSES: raise health_check_base.RedHealthError(_( "%s is not in running state") % self.process.ui_name) else: raise health_check_base.YellowHealthError(_( "%s is not in running state") % self.process.ui_name) if active_count < len(instances): if self.process.ui_name in self.IMPORTANT_PROCESSES: raise health_check_base.YellowHealthError(_( "Some %s processes are not in running state") % self.process.ui_name) return _("%s is in running state") % self.process.ui_name
def check_health(self): raise health_check_base.RedHealthError("Ooouch!")
def is_ambari_active(self): if self._exception_store: raise health_check_base.RedHealthError(self._exception_store) return _("Ambari Monitor is healthy")
def is_cloudera_active(self): if self._exception_store: raise health_check_base.RedHealthError(self._exception_store) return _("Cloudera Manager is Active")