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