Don't detect mdadm RAID in containers

tags/zabbix-agent-addons-0.2.24-1
Daniel Berteaud 7 years ago
parent 5b50016e1f
commit 0c9fad57bd
  1. 2
      zabbix_scripts/disco_raid_mdadm

@ -6,11 +6,13 @@ use JSON;
my $json;
@{$json->{data}} = ();
if (-x '/bin/systemd-detect-virt' && system('/bin/systemd-detect-virt', '-qc') != 0){
open FILE, "< /proc/mdstat" or die "Can't open /proc/mdadm : $!";
foreach my $line (<FILE>) {
next unless ($line =~ m/^(md\d+)+\s*:/);
my ($md,undef,$status,$level) = split(/\ /, $line);
push @{$json->{data}}, {"{#DEVICE}" => $md, "{#STATUS}" => $status, "{#LEVEL}" => $level};
}
}
print to_json($json);
exit(0);

Loading…
Cancel
Save