diff options
author | Tony Hutter <[email protected]> | 2017-04-21 09:27:04 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-04-21 09:27:04 -0700 |
commit | d6418de057ecb71fb4cdc1b0a89d5265d13d121a (patch) | |
tree | bb4eec33de86e05bcc12d74ac7f8ff335ee45919 /cmd/zpool/Makefile.am | |
parent | 038091fd4f8d24f308708987192065e55574bbe9 (diff) |
Prebaked scripts for zpool status/iostat -c
This patch updates the "zpool status/iostat -c" commands to only run
"pre-baked" scripts from the /etc/zfs/zpool.d directory (or wherever
you install to). The scripts can only be run from -c as an unprivileged
user (unless the ZPOOL_SCRIPTS_AS_ROOT environment var is
set by root). This was done to encourage scripts to be written is such
a way that normal users can use them, and to be cautious. If your
script needs to run a privileged command, consider adding the
appropriate line in /etc/sudoers. See zpool(8) for an example of how
to do this.
The patch also allows the scripts to output custom column names. If
the script outputs a line like:
name=value
then "name" is used for the column name, and "value" is its value.
Multiple columns can be specified by outputting multiple lines. Column
names and values can have spaces. If the value is empty, a dash (-) is
printed instead.
After all the "name=value" lines are read (if any), zpool will take the
next the next line of output (if any) and print it without a column
header. After that, no more lines will be processed. This can be
useful for printing errors.
Lastly, this patch also disables the -c option with the latency and
request size histograms, since it produced awkward output and made the
code harder to maintain.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #5852
Diffstat (limited to 'cmd/zpool/Makefile.am')
-rw-r--r-- | cmd/zpool/Makefile.am | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index b4ff106e1..f905fb73d 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -20,3 +20,54 @@ zpool_LDADD = \ $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ -lm $(LIBBLKID) + +zpoolconfdir = $(sysconfdir)/zfs/zpool.d +zpoolexecdir = $(libexecdir)/zfs/zpool.d + +EXTRA_DIST = zpool.d/README + +dist_zpoolexec_SCRIPTS = \ + zpool.d/enc \ + zpool.d/encdev \ + zpool.d/fault_led \ + zpool.d/iostat \ + zpool.d/iostat-1s \ + zpool.d/iostat-10s \ + zpool.d/label \ + zpool.d/locate_led \ + zpool.d/lsblk \ + zpool.d/model \ + zpool.d/serial \ + zpool.d/ses \ + zpool.d/size \ + zpool.d/slaves \ + zpool.d/slot \ + zpool.d/upath \ + zpool.d/vendor + +zpoolconfdefaults = \ + enc \ + encdev \ + fault_led \ + iostat \ + iostat-1s \ + iostat-10s \ + label \ + locate_led \ + lsblk \ + model \ + serial \ + ses \ + size \ + slaves \ + slot \ + upath \ + vendor + +install-data-hook: + $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)" + for f in $(zpoolconfdefaults); do \ + test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \ + -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \ + ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ + done |