Fix ZFS pool stats retrieval

This commit is contained in:
Daniel Berteaud 2018-07-04 08:11:39 +02:00
parent a7b6a4aaf5
commit 7d27a931f3
1 changed files with 2 additions and 2 deletions

View File

@ -124,8 +124,8 @@ sub convert_suffix {
sub get_zpool_stats {
my $pool = shift;
my $stats = {};
return $stats unless (-e "/proc/spl/kstat/zfs/rpool/io");
open STAT, "</proc/spl/kstat/zfs/rpool/io";
return $stats unless (-e "/proc/spl/kstat/zfs/$pool/io");
open STAT, "</proc/spl/kstat/zfs/$pool/io";
while (<STAT>){
if (m/^(?<nread>\d+)\s+(?<nwritten>\d+)\s+(?<reads>\d+)\s+(?<writes>\d+)\s+(?<wtime>\d+)\s+(?<wlentime>\d+)\s+(?<wupdate>\d+)\s+(?<rtime>\d+)\s+(?<rlentime>\d+)\s+(?<rupdate>\d+)\s+(?<wcnt>\d+)\s+(?<rcnt>\d+)/){
$stats->{$_} = $+{$_} foreach (keys %+);