Package Products :: Package ZenHub :: Package services :: Module EventService
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenHub.services.EventService

 1  #! /usr/bin/env python  
 2  ############################################################################## 
 3  #  
 4  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
 5  #  
 6  # This content is made available according to terms specified in 
 7  # License.zenoss under the directory where your Zenoss product is installed. 
 8  #  
 9  ############################################################################## 
10   
11   
12  from twisted.spread import pb 
13   
14  from Products.ZenEvents.Event import Event 
15  pb.setUnjellyableForClass(Event, Event) 
16   
17  from zenoss.protocols.services import ServiceConnectionError 
18  from Products.ZenHub.HubService import HubService 
19  from Products.ZenHub.services.ThresholdMixin import ThresholdMixin 
20  from Products.ZenHub.PBDaemon import translateError 
21  from Products.Zuul import getFacade 
22   
23  import logging 
24  log = logging.getLogger('zen.EventService') 
25 26 -class EventService(HubService, ThresholdMixin):
27 28
29 - def __init__(self, dmd, instance):
30 HubService.__init__(self, dmd, instance) 31 self.config = self.dmd.Monitors.Performance._getOb(self.instance) 32 self.methodPriorityMap = { 33 'sendEvent': 0.0, 34 'sendEvents': 0.0, 35 }
36 37 @translateError
38 - def remote_sendEvent(self, evt):
39 try: 40 return self.zem.sendEvent(evt) 41 except Exception, ex: 42 log.exception(ex)
43 44 @translateError
45 - def remote_sendEvents(self, evts):
46 return self.zem.sendEvents(evts)
47 48 @translateError
49 - def remote_getDevicePingIssues(self, *args, **kwargs):
50 zep = getFacade('zep') 51 try: 52 return zep.getDevicePingIssues() 53 except ServiceConnectionError, e: 54 # ZEN-503: Don't print a traceback in this case 55 log.warn("Unable to contact ZEP.") 56 return None
57 58 @translateError
59 - def remote_getDeviceIssues(self, *args, **kwargs):
60 zep = getFacade('zep') 61 try: 62 return zep.getDeviceIssues() 63 except ServiceConnectionError, e: 64 # ZEN-503: Don't print a traceback in this case 65 log.warn("Unable to contact ZEP.") 66 return None
67 68 @translateError 71 72 @translateError
74 return self.zem.defaultPriority
75