Trees | Indices | Help |
|
---|
|
1 ############################################################################## 2 # 3 # Copyright (C) Zenoss, Inc. 2010, all rights reserved. 4 # 5 # This content is made available according to terms specified in 6 # License.zenoss under the directory where your Zenoss product is installed. 7 # 8 ############################################################################## 9 10 11 import logging 12 13 import Globals 14 15 from twisted.spread import pb 16 17 from Products.ZenCollector.services.config import CollectorConfigService 18 from Products.ZenEvents.ZenEventClasses import Status_IpService 19 from Products.ZenModel.ServiceOrganizer import ServiceOrganizer 20 from Products.ZenModel.Service import Service 21 22 log = logging.getLogger('zen.ZenStatusConfig') 23 2426 """ 27 Represents a service component. A single DeviceProxy config will have 28 multiple service proxy components (for each service zenstatus should 29 monitor) 30 """46 47 pb.setUnjellyableForClass(ServiceProxy, ServiceProxy) 48 4932 self.device = svc.hostname() 33 self.component = svc.name() 34 self.ip = svc.getManageIp() 35 self.port = svc.getPort() 36 self.sendString = svc.getSendString() 37 self.expectRegex = svc.getExpectRegex() 38 self.timeout = svc.zStatusConnectTimeout 39 self.failSeverity = svc.getFailSeverity() 40 self.status = status 41 self.key = svc.key() 42 self.deviceManageIp = svc.device().manageIp435196 97 if __name__ == '__main__': 98 from Products.ZenHub.ServiceTester import ServiceTester 99 tester = ServiceTester(ZenStatusConfig) 104 tester.printDeviceProxy = printer 105 tester.showDeviceInfo() 10653 # Any additional attributes we want to send to daemon should be 54 # added here 55 deviceProxyAttributes = () 56 CollectorConfigService.__init__(self, dmd, 57 instance, 58 deviceProxyAttributes)5961 include = CollectorConfigService._filterDevice(self, device) 62 hasTcpComponents = False 63 for svc in device.getMonitoredComponents(collector='zenstatus'): 64 if svc.getProtocol() == "tcp": 65 hasTcpComponents = True 66 67 return include and hasTcpComponents6870 proxy = CollectorConfigService._createDeviceProxy(self, device) 71 proxy.configCycleInterval = self._prefs.statusCycleInterval 72 73 # add each component 74 proxy.components = [] 75 for svc in device.getMonitoredComponents(collector='zenstatus'): 76 if svc.getProtocol() == 'tcp': 77 # get component status 78 status = svc.getStatus(Status_IpService) 79 proxy.components.append(ServiceProxy(svc, status)) 80 81 # don't bother adding this device proxy if there aren't any services 82 # to monitor 83 if not proxy.components: 84 log.debug("Device %s skipped because there are no components", 85 proxy.id) 86 return None 87 88 return proxy8991 """ 92 When zProperties are changed on either of these two classes we 93 need to refresh which devices we are monitoring 94 """ 95 return (Service, ServiceOrganizer)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1.1812 on Mon Jul 30 17:11:44 2012 | http://epydoc.sourceforge.net |