Check $sanoidmon is defined before checking its value

tags/zabbix-agent-addons-0.2.85-1
Daniel Berteaud 5 years ago
parent 5493504e77
commit b5315cea86
  1. 4
      zabbix_scripts/check_zfs

@ -27,10 +27,10 @@ if (not $zpool or not $zfs){
print 'ZBX_NOTSUPPOTED'; print 'ZBX_NOTSUPPOTED';
exit 0; exit 0;
} }
if ($sanoidmon and not $sanoid){ if (defined $sanoidmon and not $sanoid){
die 'ZBX_NOTSUPPOTED'; die 'ZBX_NOTSUPPOTED';
} }
if (not grep { $_ eq $sanoidmon } qw(snapshot capacity health)){ if (defined $sanoidmon and not grep { $_ eq $sanoidmon } qw(snapshot capacity health)){
die 'ZBX_NOTSUPPOTED'; die 'ZBX_NOTSUPPOTED';
} }

Loading…
Cancel
Save