xref: /freebsd-src/sys/contrib/openzfs/man/man8/zed.8.in (revision bb2d13b686e3ccf6c3ccb36209dfb7dcc108b182)
1eda14cbcSMatt Macy.\"
2180f8225SMatt Macy.\" This file is part of the ZFS Event Daemon (ZED).
3eda14cbcSMatt Macy.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
4eda14cbcSMatt Macy.\" Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
516038816SMartin Matuska.\" Refer to the OpenZFS git commit log for authoritative copyright attribution.
6eda14cbcSMatt Macy.\"
7eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
8eda14cbcSMatt Macy.\" Common Development and Distribution License Version 1.0 (CDDL-1.0).
9eda14cbcSMatt Macy.\" You can obtain a copy of the license from the top-level file
10eda14cbcSMatt Macy.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
11eda14cbcSMatt Macy.\" You may not use this file except in compliance with the license.
12eda14cbcSMatt Macy.\"
1316038816SMartin Matuska.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049)
1416038816SMartin Matuska.\"
1516038816SMartin Matuska.Dd May 26, 2021
1616038816SMartin Matuska.Dt ZED 8
1716038816SMartin Matuska.Os
1816038816SMartin Matuska.
1916038816SMartin Matuska.Sh NAME
2016038816SMartin Matuska.Nm ZED
2116038816SMartin Matuska.Nd ZFS Event Daemon
2216038816SMartin Matuska.Sh SYNOPSIS
2316038816SMartin Matuska.Nm
2416038816SMartin Matuska.Op Fl fFhILMvVZ
2516038816SMartin Matuska.Op Fl d Ar zedletdir
2616038816SMartin Matuska.Op Fl p Ar pidfile
2716038816SMartin Matuska.Op Fl P Ar path
2816038816SMartin Matuska.Op Fl s Ar statefile
2916038816SMartin Matuska.Op Fl j Ar jobs
3008aba0aeSMartin Matuska.Op Fl b Ar buflen
3116038816SMartin Matuska.
3216038816SMartin Matuska.Sh DESCRIPTION
3316038816SMartin MatuskaThe
3416038816SMartin Matuska.Nm
3516038816SMartin Matuska(ZFS Event Daemon) monitors events generated by the ZFS kernel
3616038816SMartin Matuskamodule.
3716038816SMartin MatuskaWhen a zevent (ZFS Event) is posted, the
3816038816SMartin Matuska.Nm
3916038816SMartin Matuskawill run any ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks)
4016038816SMartin Matuskathat have been enabled for the corresponding zevent class.
4116038816SMartin Matuska.
4216038816SMartin Matuska.Sh OPTIONS
4316038816SMartin Matuska.Bl -tag -width "-h"
4416038816SMartin Matuska.It Fl h
45eda14cbcSMatt MacyDisplay a summary of the command-line options.
4616038816SMartin Matuska.It Fl L
47eda14cbcSMatt MacyDisplay license information.
4816038816SMartin Matuska.It Fl V
49eda14cbcSMatt MacyDisplay version information.
5016038816SMartin Matuska.It Fl v
51eda14cbcSMatt MacyBe verbose.
5216038816SMartin Matuska.It Fl f
53eda14cbcSMatt MacyForce the daemon to run if at all possible, disabling security checks and
5416038816SMartin Matuskathrowing caution to the wind.
5516038816SMartin MatuskaNot recommended for use in production.
5616038816SMartin Matuska.It Fl F
5716038816SMartin MatuskaDon't daemonise: remain attached to the controlling terminal,
5816038816SMartin Matuskalog to the standard I/O streams.
5916038816SMartin Matuska.It Fl M
60eda14cbcSMatt MacyLock all current and future pages in the virtual memory address space.
61eda14cbcSMatt MacyThis may help the daemon remain responsive when the system is under heavy
62eda14cbcSMatt Macymemory pressure.
6316038816SMartin Matuska.It Fl I
64*bb2d13b6SMartin MatuskaRequest that the daemon idle rather than exit when the kernel modules are not
65*bb2d13b6SMartin Matuskaloaded.
66*bb2d13b6SMartin MatuskaProcessing of events will start, or resume, when the kernel modules are
67*bb2d13b6SMartin Matuska(re)loaded.
6816038816SMartin MatuskaUnder Linux the kernel modules cannot be unloaded while the daemon is running.
6916038816SMartin Matuska.It Fl Z
70eda14cbcSMatt MacyZero the daemon's state, thereby allowing zevents still within the kernel
71eda14cbcSMatt Macyto be reprocessed.
7216038816SMartin Matuska.It Fl d Ar zedletdir
73eda14cbcSMatt MacyRead the enabled ZEDLETs from the specified directory.
7416038816SMartin Matuska.It Fl p Ar pidfile
75eda14cbcSMatt MacyWrite the daemon's process ID to the specified file.
7616038816SMartin Matuska.It Fl P Ar path
7716038816SMartin MatuskaCustom
7816038816SMartin Matuska.Ev $PATH
7916038816SMartin Matuskafor zedlets to use.
80*bb2d13b6SMartin MatuskaNormally zedlets run in a locked-down environment, with hardcoded paths to the
81*bb2d13b6SMartin MatuskaZFS commands
82716fd348SMartin Matuska.Pq Ev $ZFS , $ZPOOL , $ZED , … ,
8316038816SMartin Matuskaand a hard-coded
8416038816SMartin Matuska.Ev $PATH .
8516038816SMartin MatuskaThis is done for security reasons.
86*bb2d13b6SMartin MatuskaHowever, the ZFS test suite uses a custom PATH for its ZFS commands, and passes
87*bb2d13b6SMartin Matuskait to
8816038816SMartin Matuska.Nm
8916038816SMartin Matuskawith
9016038816SMartin Matuska.Fl P .
9116038816SMartin MatuskaIn short,
9216038816SMartin Matuska.Fl P
9316038816SMartin Matuskais only to be used by the ZFS test suite; never use
94eda14cbcSMatt Macyit in production!
9516038816SMartin Matuska.It Fl s Ar statefile
96eda14cbcSMatt MacyWrite the daemon's state to the specified file.
9716038816SMartin Matuska.It Fl j Ar jobs
9816038816SMartin MatuskaAllow at most
9916038816SMartin Matuska.Ar jobs
10016038816SMartin MatuskaZEDLETs to run concurrently,
10116038816SMartin Matuskadelaying execution of new ones until they finish.
10216038816SMartin MatuskaDefaults to
10316038816SMartin Matuska.Sy 16 .
10408aba0aeSMartin Matuska.It Fl b Ar buflen
10508aba0aeSMartin MatuskaCap kernel event buffer growth to
10608aba0aeSMartin Matuska.Ar buflen
10708aba0aeSMartin Matuskaentries.
10808aba0aeSMartin MatuskaThis buffer is grown when the daemon misses an event, but results in
10908aba0aeSMartin Matuskaunreclaimable memory use in the kernel.
11008aba0aeSMartin MatuskaA value of
11108aba0aeSMartin Matuska.Sy 0
11208aba0aeSMartin Matuskaremoves the cap.
11308aba0aeSMartin MatuskaDefaults to
11408aba0aeSMartin Matuska.Sy 1048576 .
11516038816SMartin Matuska.El
11616038816SMartin Matuska.Sh ZEVENTS
11716038816SMartin MatuskaA zevent is comprised of a list of nvpairs (name/value pairs).
118*bb2d13b6SMartin MatuskaEach zevent contains an EID (Event IDentifier) that uniquely identifies it
119*bb2d13b6SMartin Matuskathroughout
120eda14cbcSMatt Macythe lifetime of the loaded ZFS kernel module; this EID is a monotonically
121eda14cbcSMatt Macyincreasing integer that resets to 1 each time the kernel module is loaded.
122eda14cbcSMatt MacyEach zevent also contains a class string that identifies the type of event.
123eda14cbcSMatt MacyFor brevity, a subclass string is defined that omits the leading components
12416038816SMartin Matuskaof the class string.
12516038816SMartin MatuskaAdditional nvpairs exist to provide event details.
12616038816SMartin Matuska.Pp
127eda14cbcSMatt MacyThe kernel maintains a list of recent zevents that can be viewed (along with
12816038816SMartin Matuskatheir associated lists of nvpairs) using the
12916038816SMartin Matuska.Nm zpool Cm events Fl v
13016038816SMartin Matuskacommand.
13116038816SMartin Matuska.
13216038816SMartin Matuska.Sh CONFIGURATION
133eda14cbcSMatt MacyZEDLETs to be invoked in response to zevents are located in the
13416038816SMartin Matuska.Em enabled-zedlets
13516038816SMartin Matuskadirectory
13616038816SMartin Matuska.Pq Ar zedletdir .
13716038816SMartin MatuskaThese can be symlinked or copied from the
13816038816SMartin Matuska.Em installed-zedlets
13916038816SMartin Matuskadirectory; symlinks allow for automatic updates
140eda14cbcSMatt Macyfrom the installed ZEDLETs, whereas copies preserve local modifications.
14116038816SMartin MatuskaAs a security measure, since ownership change is a privileged operation,
14216038816SMartin MatuskaZEDLETs must be owned by root.
14316038816SMartin MatuskaThey must have execute permissions for the user,
14416038816SMartin Matuskabut they must not have write permissions for group or other.
14516038816SMartin MatuskaDotfiles are ignored.
14616038816SMartin Matuska.Pp
147eda14cbcSMatt MacyZEDLETs are named after the zevent class for which they should be invoked.
148eda14cbcSMatt MacyIn particular, a ZEDLET will be invoked for a given zevent if either its
149eda14cbcSMatt Macyclass or subclass string is a prefix of its filename (and is followed by
15016038816SMartin Matuskaa non-alphabetic character).
15116038816SMartin MatuskaAs a special case, the prefix
15216038816SMartin Matuska.Sy all
15316038816SMartin Matuskamatches all zevents.
15416038816SMartin MatuskaMultiple ZEDLETs may be invoked for a given zevent.
15516038816SMartin Matuska.
15616038816SMartin Matuska.Sh ZEDLETS
157eda14cbcSMatt MacyZEDLETs are executables invoked by the ZED in response to a given zevent.
158eda14cbcSMatt MacyThey should be written under the presumption they can be invoked concurrently,
159eda14cbcSMatt Macyand they should use appropriate locking to access any shared resources.
160eda14cbcSMatt MacyCommon variables used by ZEDLETs can be stored in the default rc file which
16116038816SMartin Matuskais sourced by scripts; these variables should be prefixed with
16216038816SMartin Matuska.Sy ZED_ .
16316038816SMartin Matuska.Pp
164eda14cbcSMatt MacyThe zevent nvpairs are passed to ZEDLETs as environment variables.
165eda14cbcSMatt MacyEach nvpair name is converted to an environment variable in the following
16616038816SMartin Matuskamanner:
1673ff01b23SMartin Matuska.Bl -enum -compact
16816038816SMartin Matuska.It
16916038816SMartin Matuskait is prefixed with
17016038816SMartin Matuska.Sy ZEVENT_ ,
17116038816SMartin Matuska.It
17216038816SMartin Matuskait is converted to uppercase, and
17316038816SMartin Matuska.It
17416038816SMartin Matuskaeach non-alphanumeric character is converted to an underscore.
17516038816SMartin Matuska.El
17616038816SMartin Matuska.Pp
177eda14cbcSMatt MacySome additional environment variables have been defined to present certain
17816038816SMartin Matuskanvpair values in a more convenient form.
17916038816SMartin MatuskaAn incomplete list of zevent environment variables is as follows:
1803ff01b23SMartin Matuska.Bl -tag -compact -width "ZEVENT_TIME_STRING"
18116038816SMartin Matuska.It Sy ZEVENT_EID
182eda14cbcSMatt MacyThe Event IDentifier.
18316038816SMartin Matuska.It Sy ZEVENT_CLASS
184eda14cbcSMatt MacyThe zevent class string.
18516038816SMartin Matuska.It Sy ZEVENT_SUBCLASS
186eda14cbcSMatt MacyThe zevent subclass string.
18716038816SMartin Matuska.It Sy ZEVENT_TIME
188eda14cbcSMatt MacyThe time at which the zevent was posted as
18916038816SMartin Matuska.Dq Em seconds nanoseconds
19016038816SMartin Matuskasince the Epoch.
19116038816SMartin Matuska.It Sy ZEVENT_TIME_SECS
19216038816SMartin MatuskaThe
19316038816SMartin Matuska.Em seconds
19416038816SMartin Matuskacomponent of
19516038816SMartin Matuska.Sy ZEVENT_TIME .
19616038816SMartin Matuska.It Sy ZEVENT_TIME_NSECS
19716038816SMartin MatuskaThe
19816038816SMartin Matuska.Em nanoseconds
19916038816SMartin Matuskacomponent of
20016038816SMartin Matuska.Sy ZEVENT_TIME .
20116038816SMartin Matuska.It Sy ZEVENT_TIME_STRING
20216038816SMartin MatuskaAn almost-RFC3339-compliant string for
20316038816SMartin Matuska.Sy ZEVENT_TIME .
20416038816SMartin Matuska.El
20516038816SMartin Matuska.Pp
206eda14cbcSMatt MacyAdditionally, the following ZED & ZFS variables are defined:
2073ff01b23SMartin Matuska.Bl -tag -compact -width "ZEVENT_TIME_STRING"
20816038816SMartin Matuska.It Sy ZED_PID
209eda14cbcSMatt MacyThe daemon's process ID.
21016038816SMartin Matuska.It Sy ZED_ZEDLET_DIR
21116038816SMartin MatuskaThe daemon's current
21216038816SMartin Matuska.Em enabled-zedlets
21316038816SMartin Matuskadirectory.
21416038816SMartin Matuska.It Sy ZFS_ALIAS
21516038816SMartin MatuskaThe alias
21616038816SMartin Matuska.Pq Dq Em name Ns - Ns Em version Ns - Ns Em release
21716038816SMartin Matuskastring of the ZFS distribution the daemon is part of.
21816038816SMartin Matuska.It Sy ZFS_VERSION
21916038816SMartin MatuskaThe ZFS version the daemon is part of.
22016038816SMartin Matuska.It Sy ZFS_RELEASE
22116038816SMartin MatuskaThe ZFS release the daemon is part of.
22216038816SMartin Matuska.El
22316038816SMartin Matuska.Pp
22416038816SMartin MatuskaZEDLETs may need to call other ZFS commands.
225*bb2d13b6SMartin MatuskaThe installation paths of the following executables are defined as environment
226*bb2d13b6SMartin Matuskavariables:
22716038816SMartin Matuska.Sy ZDB ,
22816038816SMartin Matuska.Sy ZED ,
22916038816SMartin Matuska.Sy ZFS ,
23016038816SMartin Matuska.Sy ZINJECT ,
23116038816SMartin Matuskaand
23216038816SMartin Matuska.Sy ZPOOL .
23316038816SMartin MatuskaThese variables may be overridden in the rc file.
23416038816SMartin Matuska.
23516038816SMartin Matuska.Sh FILES
23616038816SMartin Matuska.Bl -tag -width "-c"
23716038816SMartin Matuska.It Pa @sysconfdir@/zfs/zed.d
238eda14cbcSMatt MacyThe default directory for enabled ZEDLETs.
23916038816SMartin Matuska.It Pa @sysconfdir@/zfs/zed.d/zed.rc
240eda14cbcSMatt MacyThe default rc file for common variables used by ZEDLETs.
24116038816SMartin Matuska.It Pa @zfsexecdir@/zed.d
242eda14cbcSMatt MacyThe default directory for installed ZEDLETs.
24316038816SMartin Matuska.It Pa @runstatedir@/zed.pid
244eda14cbcSMatt MacyThe default file containing the daemon's process ID.
24516038816SMartin Matuska.It Pa @runstatedir@/zed.state
246eda14cbcSMatt MacyThe default file containing the daemon's state.
24716038816SMartin Matuska.El
24816038816SMartin Matuska.
24916038816SMartin Matuska.Sh SIGNALS
25016038816SMartin Matuska.Bl -tag -width "-c"
25116038816SMartin Matuska.It Sy SIGHUP
252eda14cbcSMatt MacyReconfigure the daemon and rescan the directory for enabled ZEDLETs.
25316038816SMartin Matuska.It Sy SIGTERM , SIGINT
254eda14cbcSMatt MacyTerminate the daemon.
25516038816SMartin Matuska.El
25616038816SMartin Matuska.
25716038816SMartin Matuska.Sh SEE ALSO
25816038816SMartin Matuska.Xr zfs 8 ,
25916038816SMartin Matuska.Xr zpool 8 ,
26016038816SMartin Matuska.Xr zpool-events 8
26116038816SMartin Matuska.
26216038816SMartin Matuska.Sh NOTES
26316038816SMartin MatuskaThe
26416038816SMartin Matuska.Nm
26516038816SMartin Matuskarequires root privileges.
26616038816SMartin Matuska.Pp
26716038816SMartin MatuskaDo not taunt the
26816038816SMartin Matuska.Nm .
26916038816SMartin Matuska.
27016038816SMartin Matuska.Sh BUGS
271eda14cbcSMatt MacyZEDLETs are unable to return state/status information to the kernel.
27216038816SMartin Matuska.Pp
273eda14cbcSMatt MacyInternationalization support via gettext has not been added.
274