1syseventadm(1M) System Administration Commands syseventadm(1M)
2
3
4
6 syseventadm - sysevent event specification administration
7
9 syseventadm add [-R rootdir] [-v vendor] [-p publisher]
10 [-c class] [-s subclass] [-u username] path [args]
11
12
13 syseventadm remove [-R rootdir] [-v vendor] [-p publisher]
14 [-c class] [-s subclass] [-u username] [path [args]]
15
16
17 syseventadm list [-R rootdir] [-v vendor] [-p publisher]
18 [-c class] [-s subclass] [-u username] [path [args]]
19
20
21 syseventadm restart
22
23
25 The syseventadm command is an administrative front-end to add, remove
26 and list sysevent event handlers. You can also restart the sysevent
27 daemon by use of the restart command. syseventadm can only be run by
28 root.
29
30
31 The syseventadm add command adds a handler for a sysevent event speci‐
32 fied by at least one of vendor, publisher or class. If class is speci‐
33 fied, it may be qualified with a sub-class. Only the values specified
34 for vendor, publisher, class and sub-class when adding the handler are
35 matched against sysevent events to determine if the specification
36 matches the event and the handler should be run. path is the full path‐
37 name of the command to be run in response to matching events, with
38 optional arguments (args). If username is specified, the command is
39 invoked as user username, otherwise as root.
40
41
42 The syseventadm remove command removes handlers for matching sysevent
43 event specifications. Event specifications may be matched by specifying
44 at least one of vendor, publisher, class, username or path. If class is
45 specified, it may be qualified with a sub-class. Any of vendor, pub‐
46 lisher, class, sub-class, username, path or args not specified match
47 the corresponding fields of all events. Handlers for all matching spec‐
48 ifications are removed.
49
50
51 The syseventadm list command lists the handlers for matching sysevent
52 event specifications using the same match criteria as the remove com‐
53 mand but without the requirement that at least one of vendor, pub‐
54 lisher, class, username or path be specified. With no match criteria,
55 all specifications are listed. The list command output format is: [ven‐
56 dor=vendor] [publisher=publisher] [class=class] [subclass=subclass]
57 [username=username] path [args] where each of class, sub-class, vendor,
58 publisher and username is listed only if part of the match criteria for
59 the listed specification.
60
61
62 The syseventadm restart command informs the syseventd daemon to reread
63 the sysevent registry after a change has been made by adding or remov‐
64 ing one or more sysevent handler specifications.
65
66 Argument Macro Substitution
67 The sysevent handling facility provides extensive macro capability for
68 constructing the command line arguments to be executed in response to
69 an event. Macro expansion applies only to the command line args speci‐
70 fied for an event handler, with macros expanded with data from the
71 event itself. Pre-defined macros are provided for the event class, sub‐
72 class, publisher and vendor information. Macros not matching one of the
73 pre-defined macro names cause the attribute list attached to the event
74 to be searched for an attribute of that name, with the value of the
75 matching attribute substituted on the command line.
76
77
78 Macros are introduced by the $ character, with the macro name being the
79 following token separated by a SPACE or TAB character. If the macro
80 name is embedded in text, it may be delineated by ${ and }. A \ before
81 the $ causes macro expansion not to occur.
82
83 $class The class string defining the event
84
85
86 $publisher The publisher string defining the event
87
88
89 $sequence The sequence number of the event.
90
91
92 $subclass The subclass string defining the event
93
94
95 $timestamp The timestamp of the event.
96
97
98 $vendor The vendor string defining the event
99
100
101
102 Macro names other than those pre-defined are compared against the
103 attribute list provided with the event. An attribute with name matching
104 the macro name causes the value of the attribute to be substituted as
105 ASCII text on the generated command line.
106
107
108 Use of a macro for which no attribute with that name is defined, or for
109 which multiple attributes with that name are provided, cause an error
110 and the command is not invoked.
111
112
113 Attributes with signed data types (DATA_TYPE_INT16, DATA_TYPE_INT32 and
114 DATA_TYPE_INT64) are expanded as decimal digits.
115
116
117 Attributes with unsigned data types (DATA_TYPE_BYTE, DATA_TYPE_UINT16,
118 DATA_TYPE_UINT32, DATA_TYPE_UINT64 and DATA_TYPE_HTTIME) are expanded
119 as hexadecimal digits with a 0x prefix.
120
121
122 Attributes with string data type (DATA_TYPE_STRING) are expanded with
123 the string data. The data is not quoted. If if it desired that the
124 quoted strings be generated on the command line, put quotes around the
125 macro call in the arguments.
126
127
128 Array types are expanded with each element expanded as defined for that
129 scalar type, with a space separating each element substitution.
130
132 The add, list and remove subcommands support the following options:
133
134 -c class Specify the event class, class.
135
136
137 -p publisher Specify the event publisher, publisher.
138
139
140 -R rootdir Specify an alternate root path, rootdir.
141
142 Note -
143
144 The root file system of any non-global zones must not
145 be referenced with the -R option. Doing so might dam‐
146 age the global zone's file system, might compromise
147 the security of the global zone, and might damage the
148 non-global zone's file system. See zones(5).
149
150
151 -s subclass Specify the event subclass, subclass.
152
153
154 -u username Specify the username (username) to invoke the command.
155
156
157 -v vendor Specify the vendor (vendor) that defines the event.
158 Events defined by third-party software should specify
159 the company's stock symbol as vendor. Sun-defined
160 events use SUNW.
161
162
164 The add, list and remove subcommands support the following options:
165
166 args Command arguments
167
168
169 path Full path of command to be run in response to event
170
171
173 Example 1 Adding an Event Handler
174
175
176 The following example adds an event handler for an event defined by
177 vendor MYCO ("My Company"), class EC_ENV and sub-class ESC_ENV_TEMP.
178 The command to be run is /opt/MYCOenv/bin/ec_env_temp, with arguments
179 being the class name, sub-class name and pathname derived from the
180 event attributes. The $ characters are preceded by a backslash to cir‐
181 cumvent shell interpretation. There is no need to restart the service
182 after the change since the registry is maintained on $ALTROOT.
183
184
185 # syseventadm add -R LTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \
186 /opt/MYCOenv/bin/ec_env_temp \$class \$subclass \$pathname
187
188
189
190
191 Note the caveat on the use of the -R option in the description of that
192 option, above.
193
194
195 Example 2 Removing an Event Handler
196
197
198 The following example removes the event handler added in Example 1.
199
200
201 # syseventadm remove -R LTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \
202 /opt/MYCOenv/bin/ec_env_temp class} subclass} pathname}
203
204
205
206
207 Note the caveat on the use of the -R option in the description of that
208 option, above.
209
210
211 Example 3 Listing Event Handlers
212
213
214 The following example lists all event handlers for events of class
215 EC_ENV, subclass ESC_ENV_TEMP, as defined by vendor MYCO:
216
217
218 # syseventadm list -v MYCO -c EC_ENV -s ESC_ENV_TEMP \
219 vendor=MYCO class=EC_ENV subclass=ESC_ENV_TEMP \
220 /opt/MYCOenv/bin/ec_env_temp \${class} \${subclass} \${pathname}
221
222
223
224 Example 4 Listing Event Handlers
225
226
227 The following example lists all event handlers defined by vendor VRTS.
228
229
230 # syseventadm list -v VRTS
231
232
233
234 Example 5 Removing Event Handlers
235
236
237 The following example removes all event handlers defined by vendor
238 VRTS, and restarts service.
239
240
241 # syseventadm remove -v VRTS
242 # syseventadm restart
243
244
245
246 Example 6 Listing All Event Handlers Specified to Run a Command
247
248
249 The following example lists all event handlers specified to run the
250 command /opt/MYCOenv/bin/ec_env_temp:
251
252
253 # syseventadm list /opt/MYCOenv/bin/ec_env_temp
254
255
256
257 Example 7 Removing Event Handlers and Restarting Service
258
259
260 The following example removes all event handlers specified to run the
261 command /opt/MYCOenv/bin/ec_env_temp, and restarts service:
262
263
264 # syseventadm remove /opt/MYCOenv/bin/ec_env_temp
265 # syseventadm restart
266
267
268
270 The following exit values are returned:
271
272 0 Successful completion.
273
274
275 1 No matching event specification found (remove or list commands
276 only).
277
278
279 2 Incorrect command usage.
280
281
282 3 Permission denied.
283
284
285 4 Command failed.
286
287
288 5 Out of memory.
289
290
292 See attributes(5) for descriptions of the following attributes:
293
294
295
296
297 ┌─────────────────────────────┬─────────────────────────────┐
298 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
299 ├─────────────────────────────┼─────────────────────────────┤
300 │Availability │SUNWcsu │
301 └─────────────────────────────┴─────────────────────────────┘
302
304 syseventd(1M), sysevent_post_event(3SYSEVENT), attributes(5),
305 ddi_log_sysevent(9F)
306
308 To avoid upgrade problems, packages delivering a sysevent event handler
309 should install the event handler by running syseventadm from the pack‐
310 age's postinstall script. The event handler can then be removed by run‐
311 ning syseventadm from the package's preremove script using the same
312 arguments as when added.
313
314
315
316SunOS 5.11 28 Sep 2005 syseventadm(1M)