1
2
3
4
5
6
7
8
9
10
11
12
13 import logging
14 log = logging.getLogger("zen.EventView")
15
16 from _mysql_exceptions import MySQLError
17
18 from AccessControl import ClassSecurityInfo
19 from Globals import InitializeClass
20 from Products.ZenUtils.FakeRequest import FakeRequest
21
22
24
25 security = ClassSecurityInfo()
26
28 """Return the current event manager for this object.
29 """
30 if table=='history':
31 return self.ZenEventHistory
32 return self.ZenEventManager
33
34
36 """Return the current event history for this object.
37 """
38 return self.ZenEventHistory
39
40
41 - def getJSONEventsInfo(self, offset=0, count=50, fields=[],
42 getTotalCount=True,
43
44 filter='', severity=2, state=1,
45 orderby='', REQUEST=None):
46 """Return the current event list for this managed entity.
47 """
48 kwargs = locals(); del kwargs['self']
49 return self.getEventManager().getJSONEventsInfo(self, **kwargs)
50
51
52 - def getJSONHistoryEventsInfo(self, offset=0, count=50, fields=[],
53 getTotalCount=True,
54 startdate=None, enddate=None,
55 filter='', severity=2, state=1,
56 orderby='', REQUEST=None):
57 """Return the current event list for this managed entity.
58 """
59 kwargs = locals(); del kwargs['self']
60 return self.getEventHistory().getJSONEventsInfo(self, **kwargs)
61
62
68
69
71 """Return the status number for this device of class statClass.
72 """
73 try:
74 return self.getEventManager().getStatusME(self, statusclass=statusclass, **kwargs)
75 except MySQLError:
76 log.exception("exception getting status")
77 return -1
78
79
81 """Return the status number for this device of class statClass.
82 """
83 return self.convertStatus(self.getStatus(statclass, **kwargs))
84
85
90
91
96
97
102
103
108
109
110 security.declareProtected('Manage Events','manage_deleteEvents')
124
125
126
127 - def manage_deleteBatchEvents(self, selectstatus='none', goodevids=[],
128 badevids=[], filter='',
129 offset=0, count=50, fields=[],
130 getTotalCount=True,
131 startdate=None, enddate=None,
132 severity=2, state=1, orderby='',
133 REQUEST=None, **kwargs):
134 """Delete events form this managed entity.
135 """
136 evids = self.getEventManager().getEventBatchME(self,
137 selectstatus=selectstatus,
138 goodevids=goodevids,
139 badevids=badevids,
140 filter=filter,
141 offset=offset, fields=fields,
142 getTotalCount=getTotalCount,
143 startdate=startdate,
144 enddate=enddate, severity=severity,
145 state=state, orderby=orderby,
146 **kwargs)
147 request = FakeRequest()
148 self.manage_deleteEvents(evids, request)
149 return request.get('message', '')
150
151
152 security.declareProtected('Manage Events','manage_undeleteEvents')
161
162
163
164 - def manage_undeleteBatchEvents(self, selectstatus='none', goodevids=[],
165 badevids=[], filter='',
166 offset=0, count=50, fields=[],
167 getTotalCount=True,
168 startdate=None, enddate=None,
169 severity=2, state=1, orderby='',
170 REQUEST=None, **kwargs):
171 """Delete events form this managed entity.
172 Only called from event console, so uses FakeRequest to avoid
173 page rendering.
174 """
175 evids = self.getEventHistory().getEventBatchME(self,
176 selectstatus=selectstatus,
177 goodevids=goodevids,
178 badevids=badevids,
179 filter=filter,
180 offset=offset, fields=fields,
181 getTotalCount=getTotalCount,
182 startdate=startdate,
183 enddate=enddate, severity=severity,
184 state=state, orderby=orderby,
185 **kwargs)
186 request = FakeRequest()
187 self.manage_undeleteEvents(evids, request)
188 return request.get('message', '')
189
190
191 security.declareProtected('Manage Events','manage_deleteHeartbeat')
200
201
202 security.declareProtected('Manage Events','manage_ackEvents')
207
208
209 security.declareProtected('Manage Events','manage_ackBatchEvents')
210 - def manage_ackBatchEvents(self, selectstatus='none', goodevids=[],
211 badevids=[], filter='',
212 offset=0, count=50, fields=[],
213 getTotalCount=True,
214 startdate=None, enddate=None,
215 severity=2, state=1, orderby='',
216 REQUEST=None, **kwargs):
217 """Delete events form this managed entity.
218 Only called from event console, so uses FakeRequest to avoid
219 page rendering.
220 """
221 evids = self.getEventManager().getEventBatchME(self,
222 selectstatus=selectstatus,
223 goodevids=goodevids,
224 badevids=badevids,
225 filter=filter,
226 offset=offset, fields=fields,
227 getTotalCount=getTotalCount,
228 startdate=startdate,
229 enddate=enddate, severity=severity,
230 state=state, orderby=orderby,
231 **kwargs)
232 request = FakeRequest()
233 self.manage_ackEvents(evids, request)
234 return request.get('message', '')
235
236
237 security.declareProtected('Manage Events','manage_setEventStates')
243
244
245 security.declareProtected('Manage Events','manage_createEventMap')
255
256
257 InitializeClass(EventView)
258