Fix ZFS pool stats retrieval

tags/zabbix-agent-addons-0.2.40-1
Daniel Berteaud 6 years ago
parent a7b6a4aaf5
commit 7d27a931f3
  1. 4
      zabbix_scripts/check_zfs

@ -124,8 +124,8 @@ sub convert_suffix {
sub get_zpool_stats { sub get_zpool_stats {
my $pool = shift; my $pool = shift;
my $stats = {}; my $stats = {};
return $stats unless (-e "/proc/spl/kstat/zfs/rpool/io"); return $stats unless (-e "/proc/spl/kstat/zfs/$pool/io");
open STAT, "</proc/spl/kstat/zfs/rpool/io"; open STAT, "</proc/spl/kstat/zfs/$pool/io";
while (<STAT>){ 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+)/){ 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 %+); $stats->{$_} = $+{$_} foreach (keys %+);

Loading…
Cancel
Save