|
|
@ -1,9 +1,8 @@ |
|
|
|
#!/usr/bin/perl |
|
|
|
#!/usr/bin/perl |
|
|
|
|
|
|
|
|
|
|
|
$first = 1; |
|
|
|
use JSON; |
|
|
|
|
|
|
|
my $json; |
|
|
|
print "{\n"; |
|
|
|
@{$json->{data}} = (); |
|
|
|
print "\t\"data\":[\n\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $cmd; |
|
|
|
my $cmd; |
|
|
|
my $re; |
|
|
|
my $re; |
|
|
@ -36,19 +35,15 @@ for (`$cmd`){ |
|
|
|
chomp($t); |
|
|
|
chomp($t); |
|
|
|
$critical = $t if ($t =~ m/^\d+$/); |
|
|
|
$critical = $t if ($t =~ m/^\d+$/); |
|
|
|
} |
|
|
|
} |
|
|
|
$fsname =~ s!/!\\/!g; |
|
|
|
|
|
|
|
|
|
|
|
push @{$json->{data}}, { |
|
|
|
print "\t,\n" if not $first; |
|
|
|
"{#FSNAME}" => $fsname, |
|
|
|
$first = 0; |
|
|
|
"{#FSTYPE}" => $fstype, |
|
|
|
|
|
|
|
"{#FSDEVICE}" => $block, |
|
|
|
print "\t{\n"; |
|
|
|
"{#FSWARNTHRES}" => $warning, |
|
|
|
print "\t\t\"{#FSNAME}\":\"$fsname\",\n"; |
|
|
|
"{#FSCRITTHRES}" => $critical |
|
|
|
print "\t\t\"{#FSTYPE}\":\"$fstype\"\n"; |
|
|
|
}; |
|
|
|
print "\t\t\"{#FSDEVICE}\":\"$block\"\n"; |
|
|
|
|
|
|
|
print "\t\t\"{#FSWARNTHRES}\":\"$warning\"\n"; |
|
|
|
|
|
|
|
print "\t\t\"{#FSCRITTHRES}\":\"$critical\"\n"; |
|
|
|
|
|
|
|
print "\t}\n"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
print "\n\t]\n"; |
|
|
|
print to_json($json); |
|
|
|
print "}\n"; |
|
|
|
exit(0); |
|
|
|