1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""System
15
16 $Id: System.py,v 1.45 2004/04/14 22:11:48 edahl Exp $"""
17
18 __version__ = "$Revision: 1.45 $"[11:-2]
19
20 from Acquisition import aq_parent
21 from AccessControl import ClassSecurityInfo
22 from Globals import DTMLFile
23 from Globals import InitializeClass
24
25 from AccessControl import Permissions as permissions
26
27 from Products.ZenRelations.RelSchema import *
28
29 from Products.ZenUtils.Utils import travAndColl
30
31 from DeviceOrganizer import DeviceOrganizer
32 from ZenPackable import ZenPackable
33
34
43
44
45 addSystem = DTMLFile('dtml/addSystem',globals())
46
47
48
49 -class System(DeviceOrganizer, ZenPackable):
50 """
51 System class is a device organizer that represents a business system.
52 May need to manage "services" as well so that more sophisticated
53 dependencies can be tracked.
54 """
55
56
57 dmdRootName = "Systems"
58
59 portal_type = meta_type = 'System'
60
61 event_key = "System"
62
63 default_catalog = 'systemSearch'
64
65 _properties = (
66 {'id':'systemClass', 'type':'string', 'mode':'w'},
67 {'id':'description', 'type':'text', 'mode':'w'},
68 )
69 _relations = DeviceOrganizer._relations + ZenPackable._relations + (
70 ("devices", ToMany(ToMany, "Products.ZenModel.Device", "systems")),
71 )
72
73
74 factory_type_information = (
75 {
76 'id' : 'System',
77 'meta_type' : 'System',
78 'description' : """Base class for all devices""",
79 'icon' : 'System_icon.gif',
80 'product' : 'ZenModel',
81 'factory' : 'manage_addSystem',
82 'immediate_view' : 'deviceOrganizerStatus',
83 'actions' :
84 (
85 { 'id' : 'status'
86 , 'name' : 'Status'
87 , 'action' : 'deviceOrganizerStatus'
88 , 'permissions' : (
89 permissions.view, )
90 },
91 { 'id' : 'performance'
92 , 'name' : 'Performance'
93 , 'action' : 'viewSystemPerformance'
94 , 'permissions' : (
95 permissions.view, )
96 },
97 { 'id' : 'events'
98 , 'name' : 'Events'
99 , 'action' : 'viewEvents'
100 , 'permissions' : (
101 permissions.view, )
102 },
103 { 'id' : 'historyEvents'
104 , 'name' : 'History'
105 , 'action' : 'viewHistoryEvents'
106 , 'permissions' : (
107 permissions.view, )
108 },
109 { 'id' : 'manage'
110 , 'name' : 'Administration'
111 , 'action' : 'deviceOrganizerManage'
112 , 'permissions' : ('Manage DMD',)
113 },
114 )
115 },
116 )
117
118
119 security = ClassSecurityInfo()
120
121
122 security.declareProtected('View', 'omniPingStatus')
131
132
133 security.declareProtected('View', 'omniCmtsPingStatus')
144
145
146 security.declareProtected('View', 'omniSnmpStatus')
155
156
157 security.declareProtected('View', 'omniXmlRpcStatus')
166
167
168 security.declareProtected('View', 'omniEventCount')
176
177
181
182
183 security.declareProtected('View', 'convertProdState')
185 '''convert a numeric production state to a
186 textual representation using the prodStateConversions
187 map'''
188
189 if self.prodStateConversions:
190 for line in self.prodStateConversions:
191 line = line.rstrip()
192 (sev, num) = line.split(':')
193 if int(num) == prodState:
194 return sev
195 return "Unknown"
196
197
198 InitializeClass(System)
199