aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorGiuseppe Di Natale <[email protected]>2017-06-05 13:52:15 -0400
committerBrian Behlendorf <[email protected]>2017-06-05 10:52:15 -0700
commit099700d9dff46309cdd16f4c4331daddb70d8570 (patch)
tree13383ee2af7cc69b0f790b3c3f70fbc61ae074fb /etc
parent92aceb2a7ee8c9367fdc901fed933f6f258173e0 (diff)
zpool iostat/status -c improvements
Users can now provide their own scripts to be run with 'zpool iostat/status -c'. User scripts should be placed in ~/.zpool.d to be included in zpool's default search path. Provide a script which can be used with 'zpool iostat|status -c' that will return the type of device (hdd, sdd, file). Provide a script to get various values from smartctl when using 'zpool iostat/status -c'. Allow users to define the ZPOOL_SCRIPTS_PATH environment variable which can be used to override the default 'zpool iostat/status -c' search path. Allow the ZPOOL_SCRIPTS_ENABLED environment variable to enable or disable 'zpool status/iostat -c' functionality. Use the new smart script to provide the serial command. Install /etc/sudoers.d/zfs file which contains the sudoer rule for smartctl as a sample. Allow 'zpool iostat/status -c' tests to run in tree. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Giuseppe Di Natale <[email protected]> Closes #6121 Closes #6153
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile.am4
-rw-r--r--etc/sudoers.d/Makefile.am5
-rw-r--r--etc/sudoers.d/zfs8
3 files changed, 15 insertions, 2 deletions
diff --git a/etc/Makefile.am b/etc/Makefile.am
index a62678b4e..28b955106 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = zfs $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
-DIST_SUBDIRS = init.d zfs systemd modules-load.d
+SUBDIRS = zfs sudoers.d $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
+DIST_SUBDIRS = init.d zfs systemd modules-load.d sudoers.d
diff --git a/etc/sudoers.d/Makefile.am b/etc/sudoers.d/Makefile.am
new file mode 100644
index 000000000..ca9186a7e
--- /dev/null
+++ b/etc/sudoers.d/Makefile.am
@@ -0,0 +1,5 @@
+sudoersddir = $(sysconfdir)/sudoers.d
+sudoersd_DATA = zfs
+
+EXTRA_DIST = \
+ $(top_srcdir)/etc/sudoers.d/zfs
diff --git a/etc/sudoers.d/zfs b/etc/sudoers.d/zfs
new file mode 100644
index 000000000..f66ebad21
--- /dev/null
+++ b/etc/sudoers.d/zfs
@@ -0,0 +1,8 @@
+##
+## Allow any user to run `zpool iostat/status -c smart` in order
+## to read basic SMART health statistics for a pool.
+##
+## CAUTION: Any syntax error introduced here will break sudo.
+##
+
+# ALL ALL = (root) NOPASSWD: /usr/sbin/smartctl -a /dev/[hsv]d[a-z0-9]*