1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 14:16:00 +00:00

[zpool_iostat] autoconf checks zpool executable

This commit is contained in:
Lars Kruse 2016-12-04 15:24:03 +01:00
parent 67af152b9e
commit 64c30de05f

View file

@ -1,13 +1,19 @@
#!/bin/sh #!/bin/sh
ZPOOL_BIN=/sbin/zpool
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -x "$ZPOOL_BIN" ]; then
echo yes echo yes
else
echo "no (missing executable '$ZPOOL_BIN')"
fi
exit 0 exit 0
fi 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 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") 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}') 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) zorder=$(for o in $zname; do echo "${o}_read "; echo "${o}_write "; done)