mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
099700d9df
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 <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6121 Closes #6153
53 lines
1.2 KiB
Bash
Executable File
53 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Print SCSI Enclosure Services (SES) info. The output is dependent on the name
|
|
# of the script/symlink used to call it.
|
|
#
|
|
helpstr="
|
|
enc: Show disk enclosure w:x:y:z value.
|
|
slot: Show disk slot number as reported by the enclosure.
|
|
encdev: Show /dev/sg* device associated with the enclosure disk slot.
|
|
fault_led: Show value of the disk enclosure slot fault LED.
|
|
locate_led: Show value of the disk enclosure slot locate LED.
|
|
ses: Show disk's enc, enc device, slot, and fault/locate LED values."
|
|
|
|
script=$(basename "$0")
|
|
if [ "$1" = "-h" ] ; then
|
|
echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
|
|
exit
|
|
fi
|
|
|
|
if [ "$script" = "ses" ] ; then
|
|
scripts='enc encdev slot fault_led locate_led'
|
|
else
|
|
scripts="$script"
|
|
fi
|
|
|
|
for i in $scripts ; do
|
|
if [ -z "$VDEV_ENC_SYSFS_PATH" ] ; then
|
|
echo "$i="
|
|
continue
|
|
fi
|
|
|
|
val=""
|
|
case $i in
|
|
enc)
|
|
val=$(ls "$VDEV_ENC_SYSFS_PATH/../../" 2>/dev/null)
|
|
;;
|
|
slot)
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/slot" 2>/dev/null)
|
|
;;
|
|
encdev)
|
|
val=$(ls "$VDEV_ENC_SYSFS_PATH/../device/scsi_generic" 2>/dev/null)
|
|
;;
|
|
fault_led)
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/fault" 2>/dev/null)
|
|
;;
|
|
locate_led)
|
|
val=$(cat "$VDEV_ENC_SYSFS_PATH/locate" 2>/dev/null)
|
|
;;
|
|
esac
|
|
echo "$i=$val"
|
|
done
|
|
|