def __init__(self, autostop, param_str): AbstractCriterion.__init__(self) self.seconds_count = 0 self.quantile = float(param_str.split(',')[0]) self.rt_limit = expand_to_milliseconds(param_str.split(',')[1]) self.seconds_limit = expand_to_seconds(param_str.split(',')[2]) self.autostop = autostop
def __init__(self, autostop, param_str): raise NotImplementedError AbstractCriterion.__init__(self) self.seconds_count = 0 self.quantile_hash = "" self.seconds_limit = expand_to_seconds(param_str.split(',')[0]) self.autostop = autostop
def configure(self): self.detected_conf = self.__detect_configuration() if self.detected_conf: logger.info('Detected monitoring configuration: %s', self.detected_conf) self.SECTION = self.detected_conf self.default_target = self.get_option("default_target", "localhost") if self.config.lower() == "none": self.monitoring = None self.die_on_fail = False return with open(self.config) as f: self.core.add_artifact_to_send(LPRequisites.MONITORING, unicode(f.read())) # FIXME [legacy] backward compatibility with Monitoring module # configuration below. self.monitoring.ssh_timeout = expand_to_seconds( self.get_option("ssh_timeout", "5s")) try: autostop = self.core.get_plugin_of_type(AutostopPlugin) autostop.add_criterion_class(MetricHigherCriterion) autostop.add_criterion_class(MetricLowerCriterion) except KeyError: logger.debug( "No autostop plugin found, not adding instances criterion")
def __init__(self, autostop, param_str): AbstractCriterion.__init__(self) self.seconds_count = 0 params = param_str.split(',') self.rt_limit = expand_to_milliseconds(params[0]) self.seconds_limit = expand_to_seconds(params[1]) self.autostop = autostop self.tag = params[2].strip() if len(params) == 3 else None
def __init__(self, autostop, param_str): AbstractCriterion.__init__(self) self.seconds_count = 0 self.codes_mask = param_str.split(',')[0].lower() self.codes_regex = re.compile(self.codes_mask.replace("x", '.')) self.autostop = autostop level_str = param_str.split(',')[1].strip() if level_str[-1:] == '%': self.level = float(level_str[:-1]) / 100 self.is_relative = True else: self.level = int(level_str) self.is_relative = False self.seconds_limit = expand_to_seconds(param_str.split(',')[2])
def __init__(self, autostop, param_str): AbstractCriterion.__init__(self) try: self.mon = autostop.core.get_plugin_of_type(Plugin) if self.mon.monitoring: self.mon.monitoring.add_listener(self) except KeyError: logger.warning("No monitoring module, mon autostop disabled") self.triggered = False self.autostop = autostop self.host = param_str.split(',')[0].strip() self.metric = param_str.split(',')[1].strip() self.value_limit = float(param_str.split(',')[2]) self.seconds_limit = expand_to_seconds(param_str.split(',')[3]) self.last_second = None self.seconds_count = 0
def __init__(self, autostop, param_str): AbstractCriterion.__init__(self) self.start_time = time.time() self.end_time = time.time() self.time_limit = expand_to_seconds(param_str)