Package Products :: Package ZenHub :: Package services :: Module ProcessConfig
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenHub.services.ProcessConfig

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2009, 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 Products.ZenCollector.services.config import CollectorConfigService 
15  from Products.ZenUtils.Utils import unused 
16  from Products.ZenCollector.services.config import DeviceProxy 
17  from Products.ZenEvents import Event 
18  from Products.ZenModel.OSProcessClass import OSProcessClass 
19  from Products.ZenModel.OSProcessOrganizer import OSProcessOrganizer 
20  unused(DeviceProxy) 
21   
22  from twisted.spread import pb 
23   
24 -class ProcessProxy(pb.Copyable, pb.RemoteCopy):
25 """ 26 Track process-specific configuration data 27 """ 28 name = None 29 originalName = None 30 ignoreParameters = False 31 restart = None 32 severity = Event.Warning 33 cycleTime = None 34
35 - def __init__(self):
36 pass
37
38 - def __str__(self):
39 """ 40 Override the Python default to represent ourselves as a string 41 """ 42 return str(self.name)
43 __repr__ = __str__
44 45 46 pb.setUnjellyableForClass(ProcessProxy, ProcessProxy) 47 48
49 -class ProcessConfig(CollectorConfigService):
50
51 - def __init__(self, dmd, instance):
52 deviceProxyAttributes = ('zMaxOIDPerRequest',) 53 CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
54
55 - def _filterDevice(self, device):
56 include = CollectorConfigService._filterDevice(self, device) 57 include = include and device.snmpMonitorDevice() 58 59 return include
60
61 - def _createDeviceProxy(self, device):
62 procs = device.getMonitoredComponents(collector='zenprocess') 63 if not procs: 64 return None 65 66 proxy = CollectorConfigService._createDeviceProxy(self, device) 67 proxy.configCycleInterval = self._prefs.processCycleInterval 68 69 proxy.name = device.id 70 proxy.thresholds = [] 71 proxy.processes = {} 72 proxy.snmpConnInfo = device.getSnmpConnInfo() 73 for p in procs: 74 proxy.thresholds.extend(p.getThresholdInstances('SNMP')) 75 proc = ProcessProxy() 76 proc.name = p.id 77 proc.originalName = p.name() 78 proc.ignoreParameters = ( 79 getattr(p.osProcessClass(), 'ignoreParameters', False)) 80 proc.restart = p.alertOnRestart() 81 proc.severity = p.getFailSeverity() 82 proxy.processes[p.id] = proc 83 84 return proxy
85
86 - def _getNotifiableClasses(self):
88