Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, Zenoss Inc. 5 # 6 # This program is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 #! /usr/bin/env python 14 15 from Products.ZenHub.HubService import HubService 16 17 from Products.ZenEvents.ZenEventClasses import Status_IpService 18 from Products.ZenModel.Device import Device 19 from Acquisition import aq_parent, aq_base 20 21 from Procrastinator import Procrastinate 22 23 from twisted.internet import reactor, defer 24 from sets import Set 25 26 from twisted.spread import pb2839 pb.setUnjellyableForClass(ServiceConfig, ServiceConfig) 4030 self.device = svc.hostname() 31 self.component = svc.name() 32 self.ip = svc.getManageIp() 33 self.port = svc.getPort() 34 self.sendString = svc.getSendString() 35 self.expectRegex = svc.getExpectRegex() 36 self.timeout = svc.zStatusConnectTimeout 37 self.failSeverity = svc.getFailSeverity() 38 self.key = svc.key()429244 HubService.__init__(self, dmd, instance) 45 self.config = self.dmd.Monitors.Performance._getOb(self.instance) 46 self.procrastinator = Procrastinate(self.notify)47 5052 zem = self.dmd.ZenEventManager 53 status = zem.getAllComponentStatus(Status_IpService) 54 devices = Set([d.id for d in self.config.devices()]) 55 return [x for x in status.items() if x[0][0] in devices]5658 result = [] 59 for dev in self.config.devices(): 60 dev = dev.primaryAq() 61 if not dev.monitorDevice(): continue 62 for svc in dev.getMonitoredComponents(collector='zenstatus'): 63 if svc.getProtocol() != "tcp": continue 64 result.append(ServiceConfig(svc)) 65 return result66 6769 if not self.listeners: return 70 71 # the PerformanceConf changed 72 from Products.ZenModel.PerformanceConf import PerformanceConf 73 if isinstance(object, PerformanceConf): 74 for listener in self.listeners: 75 listener.callRemote('setPropertyItems', object.propertyItems()) 76 devices = [ 77 (d.id, float(d.getLastChange())) for d in object.devices() 78 ] 79 # listener.callRemote('updateDeviceList', devices) 80 self.procrastinator.doLater()8183 lst = [] 84 for listener in self.listeners: 85 lst.append(listener.callRemote('notifyConfigChanged')) 86 return defer.DeferredList(lst)8789 for listener in self.listeners: 90 if isinstance(obj, Device): 91 listener.callRemote('deleteDevice', obj.id)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:22 2007 | http://epydoc.sourceforge.net |