Ejemplo n.º 1
0
 def get_raw_stats(self):
     sched = self.app.sched
     res = {}
     res['nb_scheduled'] = len([c for c in sched.checks.values() if c.status == 'scheduled'])
     res['nb_inpoller']  = len([c for c in sched.checks.values() if c.status == 'inpoller'])
     res['nb_zombies']   = len([c for c in sched.checks.values() if c.status == 'zombie'])
     res['nb_notifications'] = len(sched.actions)
     
     # Get a overview of the latencies with just
     # a 95 percentile view, but lso min/max values
     latencies = [s.latency for s in sched.services]
     lat_avg, lat_min, lat_max = nighty_five_percent(latencies)
     res['latency'] = (0.0,0.0,0.0)
     if lat_avg:
         res['latency'] = (lat_avg, lat_min, lat_max)
     return res
Ejemplo n.º 2
0
    def get_raw_stats(self):
        sched = self.app.sched
        res = {}
        res["nb_scheduled"] = len([c for c in sched.checks.values() if c.status == "scheduled"])
        res["nb_inpoller"] = len([c for c in sched.checks.values() if c.status == "inpoller"])
        res["nb_zombies"] = len([c for c in sched.checks.values() if c.status == "zombie"])
        res["nb_notifications"] = len(sched.actions)

        # Spare scehdulers do not have such properties
        if hasattr(sched, "services"):
            # Get a overview of the latencies with just
            # a 95 percentile view, but lso min/max values
            latencies = [s.latency for s in sched.services]
            lat_avg, lat_min, lat_max = nighty_five_percent(latencies)
            res["latency"] = (0.0, 0.0, 0.0)
            if lat_avg:
                res["latency"] = (lat_avg, lat_min, lat_max)
        return res