Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(6)  |  Derive(0)  |  Import(6)

        def servicesstatus(services):
    if services:
        hasdowntime = max([x.status[1] for x in services])
    else:
        hasdowntime = 0

    if len([x for x in services if x.status[0] == 'stale']):
        return 'unknown', hasdowntime

    if len([x for x in services if x.status[0] == 'critical' and x.status[1] is False]):
        return 'critical', hasdowntime

    elif len([x for x in services if x.status[0] == 'warning' and x.status[1] is False]):
        return 'warning', hasdowntime

    elif len([x for x in services if x.status[0] in ['ok', 'unknown'] and x.status[1] is True]):
        return 'downtime', hasdowntime

    elif len([x for x in services if x.status[0] == 'unknown']):
        return 'unknown', hasdowntime
    else:
        return 'ok', hasdowntime
        


src/n/a/NagParser-0.0.31/nagparser/Model/Host.py   NagParser(Download)
from Base import Base, servicesstatus
from NagList import NagList
 
from nagparser.Services.nicetime import getnicetimefromdatetime
 
    def getstatus(self, *arg):
        return servicesstatus(self.services)
    status = property(getstatus)
 
    def laststatuschange(self, returntimesincenow=True):

src/n/a/NagParser-HEAD/nagparser/Model/Host.py   NagParser(Download)
from Base import Base, servicesstatus
from NagList import NagList
 
from nagparser.Services.nicetime import getnicetimefromdatetime
 
    def getstatus(self, *arg):
        return servicesstatus(self.services)
    status = property(getstatus)
 
    def laststatuschange(self, returntimesincenow=True):

src/n/a/NagParser-0.0.31/nagparser/Model/ServiceGroup.py   NagParser(Download)
from NagList import NagList
from Base import Base, servicesstatus
 
from nagparser.Services.nicetime import getnicetimefromdatetime
 
    def getstatus(self, *arg):
        return servicesstatus(self.services)
    status = property(getstatus)
 
    def laststatuschange(self, returntimesincenow=True):

src/n/a/NagParser-0.0.31/nagparser/Model/Nag.py   NagParser(Download)
from datetime import datetime
 
from NagList import NagList
from Base import Base, servicesstatus
from nagparser.Model import Host, ServiceGroup
    def getstatus(self, onlyimportant=False):
        return servicesstatus(self.getservicegroups(onlyimportant))
    status = property(getstatus)
 
    def getbadhosts(self):

src/n/a/NagParser-HEAD/nagparser/Model/ServiceGroup.py   NagParser(Download)
from NagList import NagList
from Base import Base, servicesstatus
 
from nagparser.Services.nicetime import getnicetimefromdatetime
 
    def getstatus(self, *arg):
        return servicesstatus(self.services)
    status = property(getstatus)
 
    def laststatuschange(self, returntimesincenow=True):

src/n/a/NagParser-HEAD/nagparser/Model/Nag.py   NagParser(Download)
from datetime import datetime
 
from NagList import NagList
from Base import Base, servicesstatus
from nagparser.Model import Host, ServiceGroup
    def getstatus(self, onlyimportant=False):
        return servicesstatus(self.getservicegroups(onlyimportant))
    status = property(getstatus)
 
    def getbadhosts(self):