1
2
3
4
5
6
7
8
9
10
11 __doc__="""System
12
13 $Id: System.py,v 1.45 2004/04/14 22:11:48 edahl Exp $"""
14
15 __version__ = "$Revision: 1.45 $"[11:-2]
16
17 from AccessControl import ClassSecurityInfo
18 from Globals import DTMLFile
19 from Globals import InitializeClass
20
21 from AccessControl import Permissions as permissions
22
23 from Products.ZenRelations.RelSchema import *
24
25 from DeviceOrganizer import DeviceOrganizer
26 from ZenPackable import ZenPackable
27
28
37
38
39 addSystem = DTMLFile('dtml/addSystem',globals())
40
41
42
43 -class System(DeviceOrganizer, ZenPackable):
44 """
45 System class is a device organizer that represents a business system.
46 May need to manage "services" as well so that more sophisticated
47 dependencies can be tracked.
48 """
49
50
51 dmdRootName = "Systems"
52
53 portal_type = meta_type = 'System'
54
55 event_key = "System"
56
57 default_catalog = 'systemSearch'
58
59 _properties = (
60 {'id':'systemClass', 'type':'string', 'mode':'w'},
61 {'id':'description', 'type':'text', 'mode':'w'},
62 )
63 _relations = DeviceOrganizer._relations + ZenPackable._relations + (
64 ("devices", ToMany(ToMany, "Products.ZenModel.Device", "systems")),
65 )
66
67
68 factory_type_information = (
69 {
70 'id' : 'System',
71 'meta_type' : 'System',
72 'description' : """Base class for all devices""",
73 'icon' : 'System_icon.gif',
74 'product' : 'ZenModel',
75 'factory' : 'manage_addSystem',
76 'immediate_view' : 'deviceOrganizerStatus',
77 'actions' :
78 (
79 { 'id' : 'status'
80 , 'name' : 'Status'
81 , 'action' : 'deviceOrganizerStatus'
82 , 'permissions' : (
83 permissions.view, )
84 },
85 { 'id' : 'events'
86 , 'name' : 'Events'
87 , 'action' : 'viewEvents'
88 , 'permissions' : (
89 permissions.view, )
90 },
91 { 'id' : 'manage'
92 , 'name' : 'Administration'
93 , 'action' : 'deviceOrganizerManage'
94 , 'permissions' : ('Manage DMD',)
95 },
96 )
97 },
98 )
99
100
101 security = ClassSecurityInfo()
102
103
104 security.declareProtected('View', 'omniPingStatus')
113
114
115 security.declareProtected('View', 'omniCmtsPingStatus')
126
127
128 security.declareProtected('View', 'omniSnmpStatus')
137
138
139 security.declareProtected('View', 'omniXmlRpcStatus')
148
149
150 security.declareProtected('View', 'omniEventCount')
158
159
163
164
165 security.declareProtected('View', 'convertProdState')
167 '''convert a numeric production state to a
168 textual representation using the prodStateConversions
169 map'''
170
171 if self.prodStateConversions:
172 for line in self.prodStateConversions:
173 line = line.rstrip()
174 (sev, num) = line.split(':')
175 if int(num) == prodState:
176 return sev
177 return "Unknown"
178
179
180 InitializeClass(System)
181