class OSProcessInfo(ComponentInfo): implements(IOSProcessInfo) @property @info def processClass(self): # ZEN-3016: Get the primary acquisition. Processes should always have a class. klass = self._object.osProcessClass() if not klass: msg = 'Internal Error: OSProcess does not have an OSProcessClass: %s' % self.uid try: zep = getFacade('zep') device = self._object.device() zep.create(msg, 'Error', device.id, component=self.id, eventClass='/App') except ZepConnectionError: log.error(msg) return None return klass.primaryAq() @property def processName(self): return self._object.name() @property def description(self): return getattr(self.processClass, 'description', '') def getAlertOnRestart(self): return self._object.alertOnRestart() def setAlertOnRestart(self, value): if value is not None: self._object.zAlertOnRestart = value else: self._object.deleteZenProperty('zAlertOnRestart') alertOnRestart = property(getAlertOnRestart, setAlertOnRestart) def getFailSeverity(self): return self._object.getFailSeverity() def setFailSeverity(self, value): if value is not None: self._object.zFailSeverity = value else: self._object.deleteZenProperty('zFailSeverity') failSeverity = property(getFailSeverity, setFailSeverity) monitor = ServiceMonitor() @property def monitored(self): return self._object.monitored()
class WinServiceInfo(ComponentInfo): implements(IWinServiceInfo) def __init__(self, *args, **kwargs): super(ComponentInfo, self).__init__(*args, **kwargs) if self._object.serviceclass() is not None: self.serviceClassUid = self._object.serviceclass().getPrimaryUrlPath() else: self.serviceClassUid = "" @property @info def serviceClass(self): return self._object.serviceclass() @property def usesMonitorAttribute(self): return (not safe_hasattr(self._object, "startMode") \ or self._object.startMode != "Disabled") @property def monitored(self): return self._object.monitored() if self.usesMonitorAttribute else "" monitor = ServiceMonitor() @property def caption(self): return self._object.caption() command = ProxyProperty('id') def getFailSeverity(self): return self._object.getFailSeverity() def setFailSeverity(self, value): if value is not None: self._object.zFailSeverity = value else: self._object.deleteZenProperty('zFailSeverity') failSeverity = property(getFailSeverity, setFailSeverity) @property def status(self): status = self._object.getStatus() if status < 0: return 'none' elif status == 0: return 'up' else: return 'down' serviceName = ProxyProperty('serviceName') caption = ProxyProperty('caption') serviceType = ProxyProperty('serviceType') startMode = ProxyProperty('startMode') startName = ProxyProperty('startName') pathName = ProxyProperty('pathName')
class IpServiceInfo(ComponentInfo): implements(IIpServiceInfo) def __init__(self, *args, **kwargs): super(ComponentInfo, self).__init__(*args, **kwargs) if self._object.serviceclass() is not None: self.serviceClassUid = self._object.serviceclass( ).getPrimaryUrlPath() else: self.serviceClassUid = "" @property def name(self): return self._object.getKeyword() @property def usesMonitorAttribute(self): return not self._object.cantMonitor() @property def monitored(self): return self._object.monitored() if self.usesMonitorAttribute else "" monitor = ServiceMonitor() @property @info def serviceClass(self): return self._object.serviceclass() def getManageIp(self): return self._object.getManageIp() def setManageIp(self, value): self._object.manageIp = value manageIp = property(getManageIp, setManageIp) port = ProxyProperty('port') ipaddresses = ProxyProperty('ipaddresses') protocol = ProxyProperty('protocol') discoveryAgent = ProxyProperty('discoveryAgent') def getFailSeverity(self): return self._object.getFailSeverity() def setFailSeverity(self, value): if value is not None: self._object.zFailSeverity = value else: self._object.deleteZenProperty('zFailSeverity') failSeverity = property(getFailSeverity, setFailSeverity) def getSendString(self): return self._object.getSendString() def setSendString(self, value): self._object.setAqProperty("sendString", value, "string") sendString = property(getSendString, setSendString) def getExpectRegex(self): return self._object.getExpectRegex() def setExpectRegex(self, value): self._object.setAqProperty("expectRegex", value, "string") expectRegex = property(getExpectRegex, setExpectRegex)