From 3c1b2602a368edd25920ca0cc3622d2ddf461e58 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 15 May 2019 10:51:00 +0200 Subject: [PATCH] changed the way how 'ztool iostat' command get the read/write values of the Operations/Bandwidth graphs #242 --- Changes | 2 ++ lib/zfs.pm | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index de53e508..53141c33 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,8 @@ - Changed how the values in 'fail2ban.pm' are shown. Now it shows the Bans as absolute values. The new option 'graph_mode' permits switching between 'absolute' (default) and 'rate'. [#241] +- Changed the way how 'ztool iostat' command get the read/write values of the + Operations/Bandwidth graphs. [#242] - Fixed the copyright year in 'monitorix.cgi'. - Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I forgot to remove when adding the Exim support. diff --git a/lib/zfs.pm b/lib/zfs.pm index df86925d..c90ea064 100644 --- a/lib/zfs.pm +++ b/lib/zfs.pm @@ -267,6 +267,7 @@ sub zfs_update { my $pool = (split(',', $zfs->{list}))[$n] || ""; if($pool) { my @zpool; + my @data; $free = trim(`zfs get -Hp -o value available $pool`); $udata = trim(`zfs get -Hp -o value used $pool`); @@ -282,8 +283,13 @@ sub zfs_update { } $cap =~ s/%//; $fra =~ s/[%-]//g; $fra = $fra || 0; - @zpool = split(' ', `zpool iostat -Hp $pool` || ""); - (undef, undef, undef, $oper, $opew, $banr, $banw) = @zpool; + + open(IN, "zpool iostat -Hp $pool 5 2 |"); + while() { + push(@data, $_); + } + close(IN); + (undef, undef, undef, $oper, $opew, $banr, $banw) = split(' ', $data[1]); } $rrdata .= ":$free:$udata:$usnap:$cap:$fra:$oper:$opew:$banr:$banw:0";