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