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 AccessControl import ClassSecurityInfo
21 from Globals import DTMLFile
22 from Globals import InitializeClass
23
24 from AccessControl import Permissions as permissions
25
26 from Products.ZenRelations.RelSchema import *
27
28 from DeviceOrganizer import DeviceOrganizer
29 from ZenPackable import ZenPackable
30
31
40
41
42 addSystem = DTMLFile('dtml/addSystem',globals())
43
44
45
46 -class System(DeviceOrganizer, ZenPackable):
47 """
48 System class is a device organizer that represents a business system.
49 May need to manage "services" as well so that more sophisticated
50 dependencies can be tracked.
51 """
52
53
54 dmdRootName = "Systems"
55
56 portal_type = meta_type = 'System'
57
58 event_key = "System"
59
60 default_catalog = 'systemSearch'
61
62 _properties = (
63 {'id':'systemClass', 'type':'string', 'mode':'w'},
64 {'id':'description', 'type':'text', 'mode':'w'},
65 )
66 _relations = DeviceOrganizer._relations + ZenPackable._relations + (
67 ("devices", ToMany(ToMany, "Products.ZenModel.Device", "systems")),
68 )
69
70
71 factory_type_information = (
72 {
73 'id' : 'System',
74 'meta_type' : 'System',
75 'description' : """Base class for all devices""",
76 'icon' : 'System_icon.gif',
77 'product' : 'ZenModel',
78 'factory' : 'manage_addSystem',
79 'immediate_view' : 'deviceOrganizerStatus',
80 'actions' :
81 (
82 { 'id' : 'status'
83 , 'name' : 'Status'
84 , 'action' : 'deviceOrganizerStatus'
85 , 'permissions' : (
86 permissions.view, )
87 },
88 { 'id' : 'events'
89 , 'name' : 'Events'
90 , 'action' : 'viewEvents'
91 , 'permissions' : (
92 permissions.view, )
93 },
94 { 'id' : 'manage'
95 , 'name' : 'Administration'
96 , 'action' : 'deviceOrganizerManage'
97 , 'permissions' : ('Manage DMD',)
98 },
99 )
100 },
101 )
102
103
104 security = ClassSecurityInfo()
105
106
107 security.declareProtected('View', 'omniPingStatus')
116
117
118 security.declareProtected('View', 'omniCmtsPingStatus')
129
130
131 security.declareProtected('View', 'omniSnmpStatus')
140
141
142 security.declareProtected('View', 'omniXmlRpcStatus')
151
152
153 security.declareProtected('View', 'omniEventCount')
161
162
166
167
168 security.declareProtected('View', 'convertProdState')
170 '''convert a numeric production state to a
171 textual representation using the prodStateConversions
172 map'''
173
174 if self.prodStateConversions:
175 for line in self.prodStateConversions:
176 line = line.rstrip()
177 (sev, num) = line.split(':')
178 if int(num) == prodState:
179 return sev
180 return "Unknown"
181
182
183 InitializeClass(System)
184