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
26 s = self.genMeta().items()
27 s.sort()
28 result = ['<option/>']
29 for name, attrType in s:
30 result.append('<option value="%s">%s</option>' %
31 (name, attrType.label))
32 return '\n'.join(result)
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", "zenactions", "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 message=Text("Message"),
92 ntevid=Text("ntevid"),
93 ipAddress=Text("IP Address"),
94 ownerId=Select("Owner Id", owners),
95 **kw)
96
99
103
104 Modes = """
105 var modes = {
106 text:[{text:"contains",value:"~"},
107 {text:"does not contain",value:"!~"},
108 {text:"begins with",value:"^"},
109 {text:"ends with",value:"$"},
110 {text:"is",value:""},
111 {text:"is not",value:"!"}],
112 evtClass:[{text:"begins with",value:"^"},
113 {text:"does not begin with",value:"!^"},
114 {text:"is",value:""},
115 {text:"is not",value:"!"}],
116 select:[{text:"is",value:""},
117 {text:"is not",value:"!"}],
118 compare:[{text:"<",value:"<"},
119 {text:"<=",value:"<="},
120 {text:"=",value:"="},
121 {text:">",value:">"},
122 {text:">=",value:">="}],
123 cselect:[{text:"<",value:"<"},
124 {text:"<=",value:"<="},
125 {text:"=",value:"="},
126 {text:">",value:">"},
127 {text:">=",value:">="}]};
128 """
129
130 InitializeClass(EventFilter)
131