1
2
3
4
5
6
7
8
9
10
11
12
13
14 from AccessControl import ClassSecurityInfo
15 from Globals import InitializeClass
16
18 "Mix-in for objects that query events"
19
20 where = None
21 formName = 'actionRule'
22
23 security = ClassSecurityInfo()
24
33
45
54 addDevices('Systems', 'Systems', 'systems')
55 addDevices('Groups', 'Device Groups', 'deviceGroups')
56 esconv = [(b, a) for a, b in EventManagerBase.eventStateConversions]
57 sconv = [(b, a) for a, b in EventManagerBase.severityConversions]
58 pconv = self.getConversions(self.dmd.prodStateConversions)
59 pconv = [(int(b), a) for a, b in pconv]
60 dpconv = self.getConversions(self.dmd.priorityConversions)
61 dpconv = [(int(b), a) for a, b in dpconv]
62 owners = [(n, n) for n in self.dmd.ZenUsers.getAllUserSettingsNames()]
63 eventClasses = [(n, n) for n in self.dmd.Events.getOrganizerNames()]
64 deviceClasses = [(n, n) for n in self.dmd.Devices.getOrganizerNames()]
65 return dict(
66 eventClass=EventClass('Event Class', eventClasses),
67 deviceClass=EventClass('Device Class', deviceClasses),
68 summary=Text("Summary"),
69 location=Text("Location"),
70 prodState=Enumerated("Production State",pconv),
71 severity=Enumerated("Severity",sconv),
72 eventState=Enumerated("Event State",esconv),
73 device=Text("Device"),
74 devicePriority=Enumerated("Device Priority",dpconv),
75 eventClassKey=Text("Event Class Key"),
76 count=Compare("Count"),
77 manager=Text("Manager"),
78 agent=Select("Agent",[(x, x) for x in
79 "zenhub", "zenping", "zensyslog", "zentrap",
80 "zenmodeler", "zenperfsnmp", "zencommand", "zenprocess", "zenwin",
81 "zeneventlog"]),
82 facility=Select("Facility",[
83 "auth","authpriv","cron","daemon","kern","lpr","mail",
84 "mark","news","security","syslog","user","uucp",
85 "local0","local1","local2","local3","local4",
86 "local05","local6","local7"]),
87 priority=Select("Priority",[
88 "debug","info","notice","warning","error","critical",
89 "alert","emergency"]),
90 component=Text("Component"),
91 eventKey=Text("Event Key"),
92 message=Text("Message"),
93 ntevid=Text("ntevid"),
94 ipAddress=Text("IP Address"),
95 ownerId=Select("Owner Id", owners),
96 **kw)
97
100
104
105 Modes = """
106 var modes = {
107 text:[{text:"contains",value:"~"},
108 {text:"does not contain",value:"!~"},
109 {text:"begins with",value:"^"},
110 {text:"ends with",value:"$"},
111 {text:"is",value:""},
112 {text:"is not",value:"!"}],
113 evtClass:[{text:"begins with",value:"^"},
114 {text:"does not begin with",value:"!^"},
115 {text:"is",value:""},
116 {text:"is not",value:"!"}],
117 select:[{text:"is",value:""},
118 {text:"is not",value:"!"}],
119 compare:[{text:"<",value:"<"},
120 {text:"<=",value:"<="},
121 {text:"=",value:"="},
122 {text:">",value:">"},
123 {text:">=",value:">="}],
124 cselect:[{text:"<",value:"<"},
125 {text:"<=",value:"<="},
126 {text:"=",value:"="},
127 {text:">",value:">"},
128 {text:">=",value:">="}]};
129 """
130
131 InitializeClass(EventFilter)
132