Exemplo n.º 1
0
    def alert_detail(self, request):
        from freenasUI.system.models import Alert
        from freenasUI.system.alert import alertPlugins

        dismisseds = [a.message_id for a in Alert.objects.filter(dismiss=True)]
        alerts = alertPlugins.run()
        return render(request, "freeadmin/alert_status.html", {"alerts": alerts, "dismisseds": dismisseds})
Exemplo n.º 2
0
 def alert_detail(self, request):
     from freenasUI.system.models import Alert
     from freenasUI.system.alert import alertPlugins
     dismisseds = [a.message_id for a in Alert.objects.filter(dismiss=True)]
     alerts = alertPlugins.run()
     return render(request, "freeadmin/alert_status.html", {
         'alerts': alerts,
         'dismisseds': dismisseds,
     })
Exemplo n.º 3
0
 def alert_status(self, request):
     from freenasUI.system.models import Alert
     from freenasUI.system.alert import alertPlugins
     dismisseds = [a.message_id for a in Alert.objects.filter(dismiss=True)]
     alerts = alertPlugins.run()
     current = 'OK'
     for alert in alerts:
         # Skip dismissed alerts
         if alert.getId() in dismisseds:
             continue
         status = alert.getLevel()
         if ((status == 'WARN' and current == 'OK')
                 or status == 'CRIT' and current in ('OK', 'WARN')):
             current = status
     return HttpResponse(current)
Exemplo n.º 4
0
    def alert_status(self, request):
        from freenasUI.system.models import Alert
        from freenasUI.system.alert import alertPlugins

        dismisseds = [a.message_id for a in Alert.objects.filter(dismiss=True)]
        alerts = alertPlugins.run()
        current = "OK"
        for alert in alerts:
            # Skip dismissed alerts
            if alert.getId() in dismisseds:
                continue
            status = alert.getLevel()
            if (status == "WARN" and current == "OK") or status == "CRIT" and current in ("OK", "WARN"):
                current = status
        return HttpResponse(current)
Exemplo n.º 5
0
 def alert_status(self, request):
     from freenasUI.system.models import Alert
     from freenasUI.system.alert import alert_node, alertPlugins
     dismisseds = [a.message_id for a in Alert.objects.filter(node=alert_node(), dismiss=True)]
     alerts = alertPlugins.run()
     current = 'OK'
     for alert in alerts:
         # Skip dismissed alerts
         if alert.getId() in dismisseds:
             continue
         status = alert.getLevel()
         if (
             (status == 'WARN' and current == 'OK') or
             status == 'CRIT' and
             current in ('OK', 'WARN')
         ):
             current = status
     return HttpResponse(current)