Package ZenModel :: Module Monitor
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.Monitor

 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  __doc__="""Monitor 
15   
16  Base class for all Monitor or Monitor Configuration Classes.  This is 
17  an abstract class that is used for the devices to monitors 
18  relationship which says which monitors monitor which devices. 
19   
20  $Id: Monitor.py,v 1.5 2004/04/14 22:11:48 edahl Exp $""" 
21   
22  __version__ = "$Revision: 1.5 $"[11:-2] 
23   
24  from Globals import InitializeClass 
25   
26  from ZenModelRM import ZenModelRM 
27  from DeviceManagerBase import DeviceManagerBase 
28   
29 -class Monitor(ZenModelRM, DeviceManagerBase):
30 meta_type = 'Monitor' 31
32 - def breadCrumbs(self, target='dmd'):
33 bc = ZenModelRM.breadCrumbs(self) 34 return [bc[0],bc[-1]]
35
36 - def deviceMoveTargets(self):
37 """see IManageDevice""" 38 mroot = self.getDmdRoot("Monitors")._getOb(self.monitorRootName) 39 return filter(lambda x: x != self.id, mroot.objectIds())
40 41
42 - def getDeviceMoveTarget(self, moveTargetName):
43 """see IManageDevice""" 44 mroot = self.getDmdRoot("Monitors")._getOb(self.monitorRootName) 45 return mroot._getOb(moveTargetName)
46 47
48 - def getOrganizerName(self):
49 """Return the DMD path of an Organizer without its dmdSubRel names.""" 50 return self.id
51
52 - def setStatusMonitors(self, statusMonitors=None, deviceNames=None, REQUEST=None):
53 """ Provide a method to set status monitors from any organizer """ 54 if not statusMonitors: 55 if REQUEST: REQUEST['message'] = "No Monitor Selected" 56 return self.callZenScreen(REQUEST) 57 if deviceNames is None: 58 if REQUEST: REQUEST['message'] = "No Devices Selected" 59 return self.callZenScreen(REQUEST) 60 for devname in deviceNames: 61 dev = self.devices._getOb(devname) 62 dev.setStatusMonitors(statusMonitors) 63 if REQUEST: 64 REQUEST['message'] = "Status monitor set to %s" % ( 65 statusMonitors) 66 if REQUEST.has_key('oneKeyValueSoInstanceIsntEmptyAndEvalToFalse'): 67 return REQUEST['message'] 68 else: 69 return self.callZenScreen(REQUEST)
70
71 - def setPerformanceMonitor(self, performanceMonitor=None, deviceNames=None, REQUEST=None):
72 """ Provide a method to set performance monitor from any organizer """ 73 if not performanceMonitor: 74 if REQUEST: REQUEST['message'] = "No Monitor Selected" 75 return self.callZenScreen(REQUEST) 76 if deviceNames is None: 77 if REQUEST: REQUEST['message'] = "No Devices Selected" 78 return self.callZenScreen(REQUEST) 79 for devname in deviceNames: 80 dev = self.devices._getOb(devname) 81 dev.setPerformanceMonitor(performanceMonitor) 82 if REQUEST: 83 REQUEST['message'] = "Performance monitor set to %s" % ( 84 performanceMonitor) 85 if REQUEST.has_key('oneKeyValueSoInstanceIsntEmptyAndEvalToFalse'): 86 return REQUEST['message'] 87 else: 88 return self.callZenScreen(REQUEST)
89 90 91 InitializeClass(Monitor) 92