2 .\" This file is part of the ZFS Event Daemon (ZED).
3 .\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
4 .\" Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
5 .\" Refer to the OpenZFS git commit log for authoritative copyright attribution.
7 .\" The contents of this file are subject to the terms of the
8 .\" Common Development and Distribution License Version 1.0 (CDDL-1.0).
9 .\" You can obtain a copy of the license from the top-level file
10 .\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
11 .\" You may not use this file except in compliance with the license.
13 .\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049)
35 (ZFS Event Daemon) monitors events generated by the ZFS kernel
37 When a zevent (ZFS Event) is posted, the
39 will run any ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks)
40 that have been enabled for the corresponding zevent class.
45 Display a summary of the command-line options.
47 Display license information.
49 Display version information.
53 Force the daemon to run if at all possible, disabling security checks and
54 throwing caution to the wind.
55 Not recommended for use in production.
57 Don't daemonise: remain attached to the controlling terminal,
58 log to the standard I/O streams.
60 Lock all current and future pages in the virtual memory address space.
61 This may help the daemon remain responsive when the system is under heavy
64 Request that the daemon idle rather than exit when the kernel modules are not loaded.
65 Processing of events will start, or resume, when the kernel modules are (re)loaded.
66 Under Linux the kernel modules cannot be unloaded while the daemon is running.
68 Zero the daemon's state, thereby allowing zevents still within the kernel
71 Read the enabled ZEDLETs from the specified directory.
73 Write the daemon's process ID to the specified file.
78 Normally zedlets run in a locked-down environment, with hardcoded paths to the ZFS commands
79 .Pq Ev $ZFS , $ZPOOL , $ZED , … ,
82 This is done for security reasons.
83 However, the ZFS test suite uses a custom PATH for its ZFS commands, and passes it to
89 is only to be used by the ZFS test suite; never use
92 Write the daemon's state to the specified file.
96 ZEDLETs to run concurrently,
97 delaying execution of new ones until they finish.
101 Cap kernel event buffer growth to
104 This buffer is grown when the daemon misses an event, but results in
105 unreclaimable memory use in the kernel.
113 A zevent is comprised of a list of nvpairs (name/value pairs).
114 Each zevent contains an EID (Event IDentifier) that uniquely identifies it throughout
115 the lifetime of the loaded ZFS kernel module; this EID is a monotonically
116 increasing integer that resets to 1 each time the kernel module is loaded.
117 Each zevent also contains a class string that identifies the type of event.
118 For brevity, a subclass string is defined that omits the leading components
120 Additional nvpairs exist to provide event details.
122 The kernel maintains a list of recent zevents that can be viewed (along with
123 their associated lists of nvpairs) using the
124 .Nm zpool Cm events Fl v
128 ZEDLETs to be invoked in response to zevents are located in the
132 These can be symlinked or copied from the
133 .Em installed-zedlets
134 directory; symlinks allow for automatic updates
135 from the installed ZEDLETs, whereas copies preserve local modifications.
136 As a security measure, since ownership change is a privileged operation,
137 ZEDLETs must be owned by root.
138 They must have execute permissions for the user,
139 but they must not have write permissions for group or other.
140 Dotfiles are ignored.
142 ZEDLETs are named after the zevent class for which they should be invoked.
143 In particular, a ZEDLET will be invoked for a given zevent if either its
144 class or subclass string is a prefix of its filename (and is followed by
145 a non-alphabetic character).
146 As a special case, the prefix
149 Multiple ZEDLETs may be invoked for a given zevent.
152 ZEDLETs are executables invoked by the ZED in response to a given zevent.
153 They should be written under the presumption they can be invoked concurrently,
154 and they should use appropriate locking to access any shared resources.
155 Common variables used by ZEDLETs can be stored in the default rc file which
156 is sourced by scripts; these variables should be prefixed with
159 The zevent nvpairs are passed to ZEDLETs as environment variables.
160 Each nvpair name is converted to an environment variable in the following
167 it is converted to uppercase, and
169 each non-alphanumeric character is converted to an underscore.
172 Some additional environment variables have been defined to present certain
173 nvpair values in a more convenient form.
174 An incomplete list of zevent environment variables is as follows:
175 .Bl -tag -compact -width "ZEVENT_TIME_STRING"
177 The Event IDentifier.
179 The zevent class string.
180 .It Sy ZEVENT_SUBCLASS
181 The zevent subclass string.
183 The time at which the zevent was posted as
184 .Dq Em seconds nanoseconds
186 .It Sy ZEVENT_TIME_SECS
191 .It Sy ZEVENT_TIME_NSECS
196 .It Sy ZEVENT_TIME_STRING
197 An almost-RFC3339-compliant string for
201 Additionally, the following ZED & ZFS variables are defined:
202 .Bl -tag -compact -width "ZEVENT_TIME_STRING"
204 The daemon's process ID.
205 .It Sy ZED_ZEDLET_DIR
211 .Pq Dq Em name Ns - Ns Em version Ns - Ns Em release
212 string of the ZFS distribution the daemon is part of.
214 The ZFS version the daemon is part of.
216 The ZFS release the daemon is part of.
219 ZEDLETs may need to call other ZFS commands.
220 The installation paths of the following executables are defined as environment variables:
227 These variables may be overridden in the rc file.
231 .It Pa @sysconfdir@/zfs/zed.d
232 The default directory for enabled ZEDLETs.
233 .It Pa @sysconfdir@/zfs/zed.d/zed.rc
234 The default rc file for common variables used by ZEDLETs.
235 .It Pa @zfsexecdir@/zed.d
236 The default directory for installed ZEDLETs.
237 .It Pa @runstatedir@/zed.pid
238 The default file containing the daemon's process ID.
239 .It Pa @runstatedir@/zed.state
240 The default file containing the daemon's state.
246 Reconfigure the daemon and rescan the directory for enabled ZEDLETs.
247 .It Sy SIGTERM , SIGINT
248 Terminate the daemon.
259 requires root privileges.
265 ZEDLETs are unable to return state/status information to the kernel.
267 Internationalization support via gettext has not been added.