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