From 64c30de05f6000a8f27762aaf05261182185dbfb Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 4 Dec 2016 15:24:03 +0100 Subject: [PATCH] [zpool_iostat] autoconf checks zpool executable --- plugins/zfs/zpool_iostat | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/zfs/zpool_iostat b/plugins/zfs/zpool_iostat index 957e40d9..35a77f8e 100755 --- a/plugins/zfs/zpool_iostat +++ b/plugins/zfs/zpool_iostat @@ -1,13 +1,19 @@ #!/bin/sh +ZPOOL_BIN=/sbin/zpool + if [ "$1" = "autoconf" ]; then - echo yes - exit 0 + if [ -x "$ZPOOL_BIN" ]; then + echo yes + else + echo "no (missing executable '$ZPOOL_BIN')" + fi + exit 0 fi -zlines=$(/sbin/zpool iostat -v | wc -l | sed 's/ //g') +zlines=$("$ZPOOL_BIN" iostat -v | wc -l | sed 's/ //g') ztmp=/var/run/munin/zpool_iostat -/sbin/zpool iostat -v 1 1 | tail "-$zlines" > "$ztmp" +"$ZPOOL_BIN" iostat -v 1 1 | tail "-$zlines" > "$ztmp" zlist=$(gawk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next}; { if ( $4 >=0 ) print $1}' "$ztmp") zname=$(gawk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next}; { if ( $4 >=0 ) print $1}' "$ztmp" | gawk '{gsub("[^a-zA-Z0-9_]", "_", $1); print}') zorder=$(for o in $zname; do echo "${o}_read "; echo "${o}_write "; done)