1
2
3
4
5
6
7
8
9
10
11 import logging
12 import socket
13 import xmlrpclib
14
15 from Products.ZenUtils.Utils import basicAuthUrl
16
18
19 - def __init__(self, agent, username, password, url):
26
27
28 - def sendEvent(self, deviceName, evclass, msg, severity, **kwargs):
29 """
30 Send a ZenEvent to the event manager. Events must have:
31 deviceName - which is the FQDN of the device
32 evclass - the event class of the event
33 msg - the event message
34 severity - the severity of the event
35
36 agent - is the management collection system that the event came through
37
38 Other potential fields are:
39
40 """
41 event = {}
42 event['Node'] = deviceName
43 event['Class'] = evclass
44 event['Summary'] = msg
45 event['Severity'] = severity
46 event['Agent'] = self.agent
47 event['Manager'] = socket.getfqdn()
48 event.update(kwargs)
49 try:
50 self.server.sendEvent(event)
51 except SystemExit: raise
52 except:
53 raise
54 logging.exception("Event notification failed url %s", self.url)
55