Ejemplo n.º 1
0
	def serviceState(self,record):
		ret = ServiceStateOffline
		s = Service(record)
		hs = HostService(record)
		if s.isRecord() and s.enabled():
			ret = ServiceStateOnline
			if s.unique() and s.active():
				onlineHostCount = 0
				for hs in Service(record).hostServices():
					if self.serviceState(hs)==ServiceStateOnline:
						onlineHostCount += 1
				if onlineHostCount > 1:
					ret = ServiceStateConflict
				elif onlineHostCount < 1:
					ret = ServiceStateError
		elif hs.isRecord() and hs.enabled():
			if hs.pulseDateTime().secsTo(self.RefreshTime) > (60 * 10):
				ret = ServiceStateError
			else: ret = ServiceStateOnline
		return ret
Ejemplo n.º 2
0
 def serviceState(self, record):
     ret = ServiceStateOffline
     s = Service(record)
     hs = HostService(record)
     if s.isRecord() and s.enabled():
         ret = ServiceStateOnline
         if s.unique() and s.active():
             onlineHostCount = 0
             for hs in Service(record).hostServices():
                 if self.serviceState(hs) == ServiceStateOnline:
                     onlineHostCount += 1
             if onlineHostCount > 1:
                 ret = ServiceStateConflict
             elif onlineHostCount < 1:
                 ret = ServiceStateError
     elif hs.isRecord() and hs.enabled():
         if hs.pulseDateTime().secsTo(self.RefreshTime) > (60 * 10):
             ret = ServiceStateError
         else:
             ret = ServiceStateOnline
     return ret