def check_freshness(self):
        """
        Iter over all hosts and services to check freshness if check_freshness enabled and
        passive_checks_enabled are set

        For the host items, the list of hosts to check contains hosts that:
        - have freshness check enabled
        - are not yet freshness expired
        - are only passively checked

        For the service items, the list of services to check contains services that:
        - do not depend upon an host that is freshness expired
        - have freshness check enabled
        - are not yet freshness expired
        - are only passively checked

        :return: None
        """
        # Get tick count
        # (_, _, tick) = self.recurrent_works['check_freshness']

        _t0 = time.time()
        now = int(_t0)

        items = []

        # May be self.ticks is not set (unit tests context!)
        ticks = getattr(self, 'ticks', self.pushed_conf.host_freshness_check_interval)
        if self.pushed_conf.check_host_freshness \
                and ticks % self.pushed_conf.host_freshness_check_interval == 0:
            # Freshness check is configured for hosts - get the list of concerned hosts:
            # host check freshness is enabled and the host is only passively checked
            hosts = [h for h in self.hosts if h.check_freshness and not h.freshness_expired and
                     h.passive_checks_enabled and not h.active_checks_enabled]
            statsmgr.gauge('freshness.hosts-count', len(hosts))
            items.extend(hosts)
            logger.debug("Freshness check is enabled for %d hosts", len(hosts))

            hosts = [h for h in self.hosts if h.check_freshness and h.freshness_expired]
            logger.debug("Freshness still expired for %d hosts", len(hosts))
            for h in hosts:
                h.last_chk = now
                self.add(h.get_check_result_brok())
                # Update check output with last freshness check time
                h.output = "Freshness period expired: %s, last updated: %s" % (
                    datetime.utcfromtimestamp(h.last_hard_state_change).strftime(
                        "%Y-%m-%d %H:%M:%S %Z"),
                    datetime.utcfromtimestamp(h.last_chk).strftime(
                        "%Y-%m-%d %H:%M:%S %Z"))
                logger.debug("Freshness still expired: %s / %s", h.get_name(), h.output)

        # May be self.ticks is not set (unit tests context!)
        ticks = getattr(self, 'ticks', self.pushed_conf.service_freshness_check_interval)
        if self.pushed_conf.check_service_freshness \
                and ticks % self.pushed_conf.service_freshness_check_interval == 0:
            # Freshness check is configured for services - get the list of concerned services:
            # service check freshness is enabled and the service is only passively checked and
            # the depending host is not freshness expired
            services = [s for s in self.services if not self.hosts[s.host].freshness_expired and
                        s.check_freshness and not s.freshness_expired and
                        s.passive_checks_enabled and not s.active_checks_enabled]
            statsmgr.gauge('freshness.services-count', len(services))
            items.extend(services)
            logger.debug("Freshness check is enabled for %d services", len(services))

            services = [s for s in self.services if not self.hosts[s.host].freshness_expired and
                        s.check_freshness and s.freshness_expired]
            logger.debug("Freshness still expired for %d services", len(services))
            for s in services:
                s.last_chk = now
                self.add(s.get_check_result_brok())
                # Update check output with last freshness check time
                s.output = "Freshness period expired: %s, last updated: %s" % (
                    datetime.utcfromtimestamp(s.last_hard_state_change).strftime(
                        "%Y-%m-%d %H:%M:%S %Z"),
                    datetime.utcfromtimestamp(s.last_chk).strftime(
                        "%Y-%m-%d %H:%M:%S %Z"))
                logger.debug("Freshness still expired: %s / %s", s.get_full_name(), s.output)

        statsmgr.timer('freshness.items-list', time.time() - _t0)

        if not items:
            logger.debug("No freshness enabled item.")
            return

        _t0 = time.time()
        raised_checks = 0
        for elt in items:
            chk = elt.do_check_freshness(self.hosts, self.services, self.timeperiods,
                                         self.macromodulations, self.checkmodulations,
                                         self.checks, _t0)
            if chk is not None:
                self.add(chk)
                self.waiting_results.put(chk)
                raised_checks += 1
        logger.info("Raised %d checks for freshness", raised_checks)
        statsmgr.gauge('freshness.raised-checks', raised_checks)
        statsmgr.timer('freshness.do-check', time.time() - _t0)
Iter over all hosts and services to check freshness if check_freshness enabled and
        passive_checks_enabled are set

        For the host items, the list of hosts to check contains hosts that:
        - have freshness check enabled
        - are not yet freshness expired
        - are only passively checked

        For the service items, the list of services to check contains services that:
        - do not depend upon an host that is freshness expired
        - have freshness check enabled
        - are not yet freshness expired
        - are only passively checked

        :return: None