(self, svcs)
return stats
Get statistics for Services, resp. Service entities
Get statistics for Services, resp. Service entities
Get statistics for Services resp . Service entities
def get_svc_stats(self, svcs):
        """ Get statistics for Services, resp. Service entities """
        stats = {
            "services.total": 0,
            "services.ok": 0,
            "services.warning": 0,
            "services.critical": 0,
            "services.unknown": 0,
            "services.flapping": 0,
            "services.in_downtime": 0,
            "services.checked": 0,
            "services.scheduled": 0,
            "services.active_checks": 0,
            "services.passive_checks": 0,
        }
        for svc in svcs:
            if type(svc) is not dict:
                continue

            sane = self._sanitize_entity(svc)
            stats["services.total"] += 1
            stats["services.flapping"] += self._trans_binary(sane["flapping"])
            stats["services.in_downtime"] += self._trans_dtime(
                sane["in_downtime"])
            stats["services.checked"] += self._trans_binary(sane["checked"])
            stats[
                "services.scheduled"] += self._trans_binary(sane["scheduled"])
            stats["services.active_checks"] += sane["active_checks"]
            stats["services.passive_checks"] += sane["passive_checks"]
            state_key = self._trans_svc_state(sane["state"])
            stats["services.%s" % (state_key)] += 1

        return stats
def get_svc_stats ( self , svcs ) : stats = { "services.total" : 0 , "services.ok" : 0 , "services.warning" : 0 , "services.critical" : 0 , "services.unknown" : 0 , "services.flapping" : 0 , "services.in_downtime" : 0 , "services.checked" : 0 , "services.scheduled" : 0 , "services.active_checks" : 0 , "services.passive_checks" : 0 , } for svc in svcs : if type ( svc ) is not dict : continue sane = self . _sanitize_entity ( svc ) stats [ "services.total" ] += 1 stats [ "services.flapping" ] += self . _trans_binary ( sane [ "flapping" ] ) stats [ "services.in_downtime" ] += self . _trans_dtime ( sane [ "in_downtime" ] ) stats [ "services.checked" ] += self . _trans_binary ( sane [ "checked" ] ) stats [ "services.scheduled" ] += self . _trans_binary ( sane [ "scheduled" ] ) stats [ "services.active_checks" ] += sane [ "active_checks" ] stats [ "services.passive_checks" ] += sane [ "passive_checks" ] state_key = self . _trans_svc_state ( sane [ "state" ] ) stats [ "services.%s" % ( state_key ) ] += 1 return stats