2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #919 from WanpengQian/master

change dependency from gawk to awk
This commit is contained in:
Lars Kruse 2018-07-11 18:38:09 +02:00 committed by GitHub
commit 331dc14e22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,7 @@ fi
zlines=$("$ZPOOL_BIN" iostat -v | wc -l | sed 's/ //g') zlines=$("$ZPOOL_BIN" iostat -v | wc -l | sed 's/ //g')
iostats=$("$ZPOOL_BIN" iostat -v 1 1 | tail "-$zlines") iostats=$("$ZPOOL_BIN" iostat -v 1 1 | tail "-$zlines")
zlist=$(echo "$iostats" \ zlist=$(echo "$iostats" \
| gawk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next}; | awk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next};
{ if ( $4 >=0 ) print $1}' \ { if ( $4 >=0 ) print $1}' \
| tr ' ' '\n') | tr ' ' '\n')
@ -71,9 +71,9 @@ get_device_iostat_column() {
local stat_column="$2" local stat_column="$2"
# convert all numeric values into kB # convert all numeric values into kB
echo "$iostats" \ echo "$iostats" \
| gawk '{ if ($1 == "'"$device_label"'") print $'"$stat_column"'; }' \ | awk '{ if ($1 == "'"$device_label"'") print $'"$stat_column"'; }' \
| gawk '/M/ {print strtonum($1)*1000}; | awk '/M/ {print int($1)*1000};
/K/ {print strtonum($1)}; /K/ {print int($1)};
/[0-9]$/ {print int($1)/1000}' /[0-9]$/ {print int($1)/1000}'
} }