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

Source Code for Module ZenHub.services.CommandConfig

 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   
14  from PerformanceConfig import PerformanceConfig 
15  from ZODB.POSException import POSError 
16   
17 -class CommandConfig(PerformanceConfig):
18
19 - def remote_getDataSourceCommands(self, devices = None):
21 22
23 - def getDeviceConfig(self, device):
25 26
27 - def sendDeviceConfig(self, listener, config):
28 return listener.callRemote('updateConfig', config)
29 30
31 - def getDataSourceCommands(self, devices = None):
32 '''Get the command configuration for all devices. 33 ''' 34 result = [] 35 for dev in self.config.devices(): 36 if devices and dev.id not in devices: continue 37 dev = dev.primaryAq() 38 try: 39 cmdinfo = dev.getDataSourceCommands() 40 if not cmdinfo: continue 41 result.append(cmdinfo) 42 except POSError: raise 43 except: 44 self.log.exception("device %s", dev.id) 45 return result
46
47 - def update(self, object):
48 from Products.ZenModel.RRDDataSource import RRDDataSource 49 if isinstance(object, RRDDataSource): 50 if object.sourcetype != 'COMMAND': 51 return 52 53 PerformanceConfig.update(self, object)
54