Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2008, 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 14 from Acquisition import aq_base 15 16 from PerformanceConfig import PerformanceConfig 17 from Products.ZenHub.PBDaemon import translateError 18 from Products.DataCollector.DeviceProxy import DeviceProxy 19 20 from Products.DataCollector.Plugins import loadPlugins 21 22 import logging 23 log = logging.getLogger('zen.ModelerService') 2426 27 plugins = None 2812430 PerformanceConfig.__init__(self, dmd, instance) 31 self.config = self.dmd.Monitors.Performance._getOb(self.instance) 32 self.methodPriorityMap = { 33 'applyDataMaps': 0.75, 34 }3537 if self.plugins is None: 38 self.plugins = {} 39 for loader in loadPlugins(self.dmd): 40 try: 41 plugin = loader.create() 42 plugin.loader = loader 43 self.plugins[plugin.name()] = plugin 44 except Exception, ex: 45 log.exception(ex) 46 47 result = DeviceProxy() 48 result.id = dev.getId() 49 if not dev.manageIp: 50 dev.setManageIp() 51 result.manageIp = dev.manageIp 52 result.plugins = [] 53 for name in dev.zCollectorPlugins: 54 plugin = self.plugins.get(name, None) 55 log.debug('checking plugin %s for device %s' % (name, dev.getId())) 56 if plugin and plugin.condition(dev, log): 57 log.debug('adding plugin %s for device %s' % (name,dev.getId())) 58 result.plugins.append(plugin.loader) 59 plugin.copyDataToProxy(dev, result) 60 result.temp_device = dev.isTempDevice() 61 return result62 63 @translateError65 result = [] 66 for dc in self.dmd.Devices.getSubOrganizers(): 67 localPlugins = getattr(aq_base(dc), 'zCollectorPlugins', False) 68 if not localPlugins: continue 69 result.append((dc.getOrganizerName(), localPlugins)) 70 return result71 72 @translateError74 result = [] 75 for name in names: 76 device = self.getPerformanceMonitor().findDevice(name) 77 if not device: 78 continue 79 device = device.primaryAq() 80 if (device.productionState < 81 getattr(device, 'zProdStateThreshold', 0)): 82 continue 83 result.append(self.createDeviceProxy(device)) 84 return result85 86 @translateError88 if monitor is None: 89 monitor = self.instance 90 monitor = self.dmd.Monitors.Performance._getOb(monitor) 91 return [d.id for d in monitor.devices.objectValuesGen()]92 93 @translateError95 if monitor is None: 96 monitor = self.instance 97 root = self.dmd.Devices.getOrganizer(organizer) 98 return [d.id for d in root.getSubDevicesGen() \ 99 if d.getPerformanceServerName() == monitor]100 101 @translateError103 from Products.DataCollector.ApplyDataMap import ApplyDataMap 104 device = self.getPerformanceMonitor().findDevice(device) 105 adm = ApplyDataMap(self) 106 changed = False 107 for map in maps: 108 if adm._applyDataMap(device, map): 109 changed = True 110 return changed111 112 @translateError114 device = self.getPerformanceMonitor().findDevice(device) 115 device.setSnmpLastCollection() 116 from transaction import commit 117 commit()118 119 120
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu May 7 11:46:28 2009 | http://epydoc.sourceforge.net |