Example #1
0
    def _check_rise(self):
        self._fall = 0
        self._rise += 1

        if self._rise >= self.monitor['rise'] and self.content_id in get_status():
            logging.info('{}: {}: status rise'.format(self.name, self.monitor))
            get_status().remove(self.content_id)
Example #2
0
    def _check_fall(self):
        self._fall += 1
        self._rise = 0

        if self._fall >= self.monitor['fall'] and self.content_id not in get_status():
            logging.error('{}: {}: status fall'.format(self.name, self.monitor))
            get_status().add(self.content_id)
Example #3
0
    def _clean_status(self):
        check_ids = set(check['id'] for check in self._checks)
        stale_ids = get_status().difference(check_ids)

        if stale_ids:
            logging.debug('{}: clean status for records: {}'.format(
                type(self).__name__, ', '.join(map(str, stale_ids))))
            get_status().intersection_update(check_ids)
Example #4
0
    def _check_rise(self):
        self._fall = 0
        self._rise += 1

        if self._rise >= self.monitor[
                'rise'] and self.content_id in get_status():
            logging.info('{}: {}: status rise'.format(self.name, self.monitor))
            get_status().remove(self.content_id)
Example #5
0
    def _check_fall(self):
        self._fall += 1
        self._rise = 0

        if self._fall >= self.monitor[
                'fall'] and self.content_id not in get_status():
            logging.error('{}: {}: status fall'.format(self.name,
                                                       self.monitor))
            get_status().add(self.content_id)
Example #6
0
    def _clean_status(self):
        check_ids = set(check["id"] for check in self._checks)
        stale_ids = get_status().difference(check_ids)

        if stale_ids:
            logging.debug(
                "{}: clean status for records: {}".format(type(self).__name__, ", ".join(map(str, stale_ids)))
            )
            get_status().intersection_update(check_ids)