zed.8: modernise

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12125
This commit is contained in:
наб 2021-05-26 18:29:29 +02:00 committed by Brian Behlendorf
parent 3bcbb6af16
commit 1f3cbcfcc5

View File

@ -10,240 +10,247 @@
.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>. .\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
.\" You may not use this file except in compliance with the license. .\" You may not use this file except in compliance with the license.
.\" .\"
.TH ZED 8 "Aug 24, 2020" OpenZFS .\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049)
.\"
.SH NAME .Dd May 26, 2021
ZED \- ZFS Event Daemon .Dt ZED 8
.Os
.SH SYNOPSIS .
.HP .Sh NAME
.B zed .Nm ZED
.\" [\fB\-c\fR \fIconfigfile\fR] .Nd ZFS Event Daemon
[\fB\-d\fR \fIzedletdir\fR] .Sh SYNOPSIS
[\fB\-f\fR] .Nm
[\fB\-F\fR] .Op Fl fFhILMvVZ
[\fB\-h\fR] .Op Fl d Ar zedletdir
[\fB\-I\fR] .Op Fl p Ar pidfile
[\fB\-L\fR] .Op Fl P Ar path
[\fB\-M\fR] .Op Fl s Ar statefile
[\fB\-p\fR \fIpidfile\fR] .Op Fl j Ar jobs
[\fB\-P\fR \fIpath\fR] .
[\fB\-s\fR \fIstatefile\fR] .Sh DESCRIPTION
[\fB\-j\fR \fIjobs\fR] The
[\fB\-v\fR] .Nm
[\fB\-V\fR] (ZFS Event Daemon) monitors events generated by the ZFS kernel
[\fB\-Z\fR] module.
When a zevent (ZFS Event) is posted, the
.SH DESCRIPTION .Nm
.PP will run any ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks)
\fBZED\fR (ZFS Event Daemon) monitors events generated by the ZFS kernel that have been enabled for the corresponding zevent class.
module. When a zevent (ZFS Event) is posted, \fBZED\fR will run any ZEDLETs .
(ZFS Event Daemon Linkage for Executable Tasks) that have been enabled for the .Sh OPTIONS
corresponding zevent class. .Bl -tag -width "-h"
.It Fl h
.SH OPTIONS
.TP
.BI \-h
Display a summary of the command-line options. Display a summary of the command-line options.
.TP .It Fl L
.BI \-L
Display license information. Display license information.
.TP .It Fl V
.BI \-V
Display version information. Display version information.
.TP .It Fl v
.BI \-v
Be verbose. Be verbose.
.TP .It Fl f
.BI \-f
Force the daemon to run if at all possible, disabling security checks and Force the daemon to run if at all possible, disabling security checks and
throwing caution to the wind. Not recommended for use in production. throwing caution to the wind.
.TP Not recommended for use in production.
.BI \-F .It Fl F
Run the daemon in the foreground. Don't daemonise: remain attached to the controlling terminal,
.TP log to the standard I/O streams.
.BI \-M .It Fl M
Lock all current and future pages in the virtual memory address space. Lock all current and future pages in the virtual memory address space.
This may help the daemon remain responsive when the system is under heavy This may help the daemon remain responsive when the system is under heavy
memory pressure. memory pressure.
.TP .It Fl I
.BI \-I Request that the daemon idle rather than exit when the kernel modules are not loaded.
Request that the daemon idle rather than exit when the kernel modules are Processing of events will start, or resume, when the kernel modules are (re)loaded.
not loaded. Processing of events will start, or resume, when the kernel Under Linux the kernel modules cannot be unloaded while the daemon is running.
modules are (re)loaded. Under Linux the kernel modules cannot be unloaded .It Fl Z
while the daemon is running.
.TP
.BI \-Z
Zero the daemon's state, thereby allowing zevents still within the kernel Zero the daemon's state, thereby allowing zevents still within the kernel
to be reprocessed. to be reprocessed.
.TP .It Fl d Ar zedletdir
.BI \-d\ zedletdir
Read the enabled ZEDLETs from the specified directory. Read the enabled ZEDLETs from the specified directory.
.TP .It Fl p Ar pidfile
.BI \-p\ pidfile
Write the daemon's process ID to the specified file. Write the daemon's process ID to the specified file.
.TP .It Fl P Ar path
.BI \-P\ path Custom
Custom $PATH for zedlets to use. Normally zedlets run in a locked-down .Ev $PATH
environment, with hardcoded paths to the ZFS commands ($ZFS, $ZPOOL, $ZED, ...), for zedlets to use.
and a hardcoded $PATH. This is done for security reasons. However, the Normally zedlets run in a locked-down environment, with hardcoded paths to the ZFS commands
ZFS test suite uses a custom PATH for its ZFS commands, and passes it to zed .Pq Ev $ZFS , $ZPOOL , $ZED , ... ,
with -P. In short, -P is only to be used by the ZFS test suite; never use and a hard-coded
.Ev $PATH .
This is done for security reasons.
However, the ZFS test suite uses a custom PATH for its ZFS commands, and passes it to
.Nm
with
.Fl P .
In short,
.Fl P
is only to be used by the ZFS test suite; never use
it in production! it in production!
.TP .It Fl s Ar statefile
.BI \-s\ statefile
Write the daemon's state to the specified file. Write the daemon's state to the specified file.
.TP .It Fl j Ar jobs
.BI \-j\ jobs Allow at most
Allow at most \fIjobs\fR ZEDLETs to run concurrently, .Ar jobs
ZEDLETs to run concurrently,
delaying execution of new ones until they finish. delaying execution of new ones until they finish.
Defaults to 16. Defaults to
.SH ZEVENTS .Sy 16 .
.PP .El
A zevent is comprised of a list of nvpairs (name/value pairs). Each zevent .Sh ZEVENTS
contains an EID (Event IDentifier) that uniquely identifies it throughout A zevent is comprised of a list of nvpairs (name/value pairs).
Each zevent contains an EID (Event IDentifier) that uniquely identifies it throughout
the lifetime of the loaded ZFS kernel module; this EID is a monotonically the lifetime of the loaded ZFS kernel module; this EID is a monotonically
increasing integer that resets to 1 each time the kernel module is loaded. increasing integer that resets to 1 each time the kernel module is loaded.
Each zevent also contains a class string that identifies the type of event. Each zevent also contains a class string that identifies the type of event.
For brevity, a subclass string is defined that omits the leading components For brevity, a subclass string is defined that omits the leading components
of the class string. Additional nvpairs exist to provide event details. of the class string.
.PP Additional nvpairs exist to provide event details.
.Pp
The kernel maintains a list of recent zevents that can be viewed (along with The kernel maintains a list of recent zevents that can be viewed (along with
their associated lists of nvpairs) using the "\fBzpool events \-v\fR" command. their associated lists of nvpairs) using the
.Nm zpool Cm events Fl v
.SH CONFIGURATION command.
.PP .
.Sh CONFIGURATION
ZEDLETs to be invoked in response to zevents are located in the ZEDLETs to be invoked in response to zevents are located in the
\fIenabled-zedlets\fR directory. These can be symlinked or copied from the .Em enabled-zedlets
\fIinstalled-zedlets\fR directory; symlinks allow for automatic updates directory
.Pq Ar zedletdir .
These can be symlinked or copied from the
.Em installed-zedlets
directory; symlinks allow for automatic updates
from the installed ZEDLETs, whereas copies preserve local modifications. from the installed ZEDLETs, whereas copies preserve local modifications.
As a security measure, since ownership change is a privileged operation, As a security measure, since ownership change is a privileged operation,
ZEDLETs must be owned by root. They must have execute permissions for the user, ZEDLETs must be owned by root.
They must have execute permissions for the user,
but they must not have write permissions for group or other. but they must not have write permissions for group or other.
Dotfiles are ignored. Dotfiles are ignored.
.PP .Pp
ZEDLETs are named after the zevent class for which they should be invoked. ZEDLETs are named after the zevent class for which they should be invoked.
In particular, a ZEDLET will be invoked for a given zevent if either its In particular, a ZEDLET will be invoked for a given zevent if either its
class or subclass string is a prefix of its filename (and is followed by class or subclass string is a prefix of its filename (and is followed by
a non-alphabetic character). As a special case, the prefix "all" matches a non-alphabetic character).
all zevents. Multiple ZEDLETs may be invoked for a given zevent. As a special case, the prefix
.Sy all
.SH ZEDLETS matches all zevents.
.PP Multiple ZEDLETs may be invoked for a given zevent.
.
.Sh ZEDLETS
ZEDLETs are executables invoked by the ZED in response to a given zevent. ZEDLETs are executables invoked by the ZED in response to a given zevent.
They should be written under the presumption they can be invoked concurrently, They should be written under the presumption they can be invoked concurrently,
and they should use appropriate locking to access any shared resources. and they should use appropriate locking to access any shared resources.
Common variables used by ZEDLETs can be stored in the default rc file which Common variables used by ZEDLETs can be stored in the default rc file which
is sourced by scripts; these variables should be prefixed with "ZED_". is sourced by scripts; these variables should be prefixed with
.PP .Sy ZED_ .
.Pp
The zevent nvpairs are passed to ZEDLETs as environment variables. The zevent nvpairs are passed to ZEDLETs as environment variables.
Each nvpair name is converted to an environment variable in the following Each nvpair name is converted to an environment variable in the following
manner: 1) it is prefixed with "ZEVENT_", 2) it is converted to uppercase, manner:
and 3) each non-alphanumeric character is converted to an underscore. .Bl -enum
.It
it is prefixed with
.Sy ZEVENT_ ,
.It
it is converted to uppercase, and
.It
each non-alphanumeric character is converted to an underscore.
.El
.Pp
Some additional environment variables have been defined to present certain Some additional environment variables have been defined to present certain
nvpair values in a more convenient form. An incomplete list of zevent nvpair values in a more convenient form.
environment variables is as follows: An incomplete list of zevent environment variables is as follows:
.TP .Bl -tag -width "ZEVENT_TIME_STRING"
.B .It Sy ZEVENT_EID
ZEVENT_EID
The Event IDentifier. The Event IDentifier.
.TP .It Sy ZEVENT_CLASS
.B
ZEVENT_CLASS
The zevent class string. The zevent class string.
.TP .It Sy ZEVENT_SUBCLASS
.B
ZEVENT_SUBCLASS
The zevent subclass string. The zevent subclass string.
.TP .It Sy ZEVENT_TIME
.B
ZEVENT_TIME
The time at which the zevent was posted as The time at which the zevent was posted as
"\fIseconds\fR\ \fInanoseconds\fR" since the Epoch. .Dq Em seconds nanoseconds
.TP since the Epoch.
.B .It Sy ZEVENT_TIME_SECS
ZEVENT_TIME_SECS The
The \fIseconds\fR component of ZEVENT_TIME. .Em seconds
.TP component of
.B .Sy ZEVENT_TIME .
ZEVENT_TIME_NSECS .It Sy ZEVENT_TIME_NSECS
The \fInanoseconds\fR component of ZEVENT_TIME. The
.TP .Em nanoseconds
.B component of
ZEVENT_TIME_STRING .Sy ZEVENT_TIME .
An almost-RFC3339-compliant string for ZEVENT_TIME. .It Sy ZEVENT_TIME_STRING
.PP An almost-RFC3339-compliant string for
.Sy ZEVENT_TIME .
.El
.Pp
Additionally, the following ZED & ZFS variables are defined: Additionally, the following ZED & ZFS variables are defined:
.TP .Bl -tag -width "ZEVENT_TIME_STRING"
.B .It Sy ZED_PID
ZED_PID
The daemon's process ID. The daemon's process ID.
.TP .It Sy ZED_ZEDLET_DIR
.B The daemon's current
ZED_ZEDLET_DIR .Em enabled-zedlets
The daemon's current \fIenabled-zedlets\fR directory. directory.
.TP .It Sy ZFS_ALIAS
.B The alias
ZFS_ALIAS .Pq Dq Em name Ns - Ns Em version Ns - Ns Em release
The ZFS alias (\fIname-version-release\fR) string used to build the daemon. string of the ZFS distribution the daemon is part of.
.TP .It Sy ZFS_VERSION
.B The ZFS version the daemon is part of.
ZFS_VERSION .It Sy ZFS_RELEASE
The ZFS version used to build the daemon. The ZFS release the daemon is part of.
.TP .El
.B .Pp
ZFS_RELEASE ZEDLETs may need to call other ZFS commands.
The ZFS release used to build the daemon. The installation paths of the following executables are defined as environment variables:
.PP .Sy ZDB ,
ZEDLETs may need to call other ZFS commands. The installation paths of .Sy ZED ,
the following executables are defined: \fBZDB\fR, \fBZED\fR, \fBZFS\fR, .Sy ZFS ,
\fBZINJECT\fR, and \fBZPOOL\fR. These variables can be overridden in the .Sy ZINJECT ,
rc file if needed. and
.Sy ZPOOL .
.SH FILES These variables may be overridden in the rc file.
.TP .
.I @sysconfdir@/zfs/zed.d .Sh FILES
.Bl -tag -width "-c"
.It Pa @sysconfdir@/zfs/zed.d
The default directory for enabled ZEDLETs. The default directory for enabled ZEDLETs.
.TP .It Pa @sysconfdir@/zfs/zed.d/zed.rc
.I @sysconfdir@/zfs/zed.d/zed.rc
The default rc file for common variables used by ZEDLETs. The default rc file for common variables used by ZEDLETs.
.TP .It Pa @zfsexecdir@/zed.d
.I @zfsexecdir@/zed.d
The default directory for installed ZEDLETs. The default directory for installed ZEDLETs.
.TP .It Pa @runstatedir@/zed.pid
.I @runstatedir@/zed.pid
The default file containing the daemon's process ID. The default file containing the daemon's process ID.
.TP .It Pa @runstatedir@/zed.state
.I @runstatedir@/zed.state
The default file containing the daemon's state. The default file containing the daemon's state.
.El
.SH SIGNALS .
.TP .Sh SIGNALS
.B HUP .Bl -tag -width "-c"
.It Sy SIGHUP
Reconfigure the daemon and rescan the directory for enabled ZEDLETs. Reconfigure the daemon and rescan the directory for enabled ZEDLETs.
.TP .It Sy SIGTERM , SIGINT
.B TERM
Terminate the daemon. Terminate the daemon.
.El
.SH NOTES .
.PP .Sh SEE ALSO
\fBZED\fR requires root privileges. .Xr zfs-events 5 ,
.\" Do not taunt zed. .Xr zfs 8 ,
.Xr zpool 8 ,
.SH BUGS .Xr zpool-events 8
.PP .
.Sh NOTES
The
.Nm
requires root privileges.
.Pp
Do not taunt the
.Nm .
.
.Sh BUGS
ZEDLETs are unable to return state/status information to the kernel. ZEDLETs are unable to return state/status information to the kernel.
.PP .Pp
Internationalization support via gettext has not been added. Internationalization support via gettext has not been added.
.SH LICENSE
.PP
\fBZED\fR (ZFS Event Daemon) is distributed under the terms of the
Common Development and Distribution License Version 1.0 (CDDL\-1.0).
.PP
Developed at Lawrence Livermore National Laboratory (LLNL\-CODE\-403049).
.SH SEE ALSO
.BR zfs (8),
.BR zpool (8)
.BR zpool-events (8)