Fix #1462
This commit is contained in:
parent
83ac39651d
commit
5546b05a3d
|
@ -209,14 +209,15 @@ sub output_json {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
my $force_ignore_perfdata = (defined($options{force_ignore_perfdata}) && $options{force_ignore_perfdata} == 1) ? 1 : 0;
|
my $force_ignore_perfdata = (defined($options{force_ignore_perfdata}) && $options{force_ignore_perfdata} == 1) ? 1 : 0;
|
||||||
my $force_long_output = (defined($options{force_long_output}) && $options{force_long_output} == 1) ? 1 : 0;
|
my $force_long_output = (defined($options{force_long_output}) && $options{force_long_output} == 1) ? 1 : 0;
|
||||||
my $json_content = {plugin => {
|
my $json_content = {
|
||||||
name => $self->{plugin},
|
plugin => {
|
||||||
mode => $self->{mode},
|
name => $self->{plugin},
|
||||||
exit => $options{exit_litteral},
|
mode => $self->{mode},
|
||||||
outputs => [],
|
exit => $options{exit_litteral},
|
||||||
perfdatas => []
|
outputs => [],
|
||||||
}
|
perfdatas => []
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
foreach my $code_litteral (keys %{$self->{global_short_outputs}}) {
|
foreach my $code_litteral (keys %{$self->{global_short_outputs}}) {
|
||||||
foreach (@{$self->{global_short_outputs}->{$code_litteral}}) {
|
foreach (@{$self->{global_short_outputs}->{$code_litteral}}) {
|
||||||
|
|
|
@ -95,9 +95,18 @@ sub manage_selection {
|
||||||
# Header not needed
|
# Header not needed
|
||||||
shift @lines;
|
shift @lines;
|
||||||
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
||||||
next if ($line !~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/);
|
# Can be very different.
|
||||||
my ($fs, $size, $available, $percent, $iused, $ipercent, $mount) = ($1, $2, $3, $4, $5, $6, $7);
|
#Filesystem 512-blocks Used Free %Used Iused Ifree %Iused Mounted on
|
||||||
|
#/dev/hd4 1048576 118408 930168 12% 3699 104325 4% /
|
||||||
|
#
|
||||||
|
#Filesystem 512-blocks Free %Used Iused %Iused Mounted on
|
||||||
|
#/dev/hd0 19368 9976 48% 4714 5% /
|
||||||
|
|
||||||
|
next if ($line !~ /^(\S+)/);
|
||||||
|
my $fs = $1;
|
||||||
|
next if ($line !~ /(\d+)%\s+([^%]*?)$/);
|
||||||
|
my ($ipercent, $mount) = ($1, $2);
|
||||||
|
|
||||||
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
||||||
$fs !~ /$self->{option_results}->{filter_fs}/);
|
$fs !~ /$self->{option_results}->{filter_fs}/);
|
||||||
|
|
||||||
|
@ -108,9 +117,6 @@ sub manage_selection {
|
||||||
next if (defined($self->{option_results}->{name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi})
|
next if (defined($self->{option_results}->{name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi})
|
||||||
&& $mount ne $self->{option_results}->{name});
|
&& $mount ne $self->{option_results}->{name});
|
||||||
|
|
||||||
next if ($iused !~ m/^\d+$/);
|
|
||||||
|
|
||||||
$ipercent =~ s/%//g;
|
|
||||||
$self->{inodes}->{$mount} = { display => $mount, used => $ipercent };
|
$self->{inodes}->{$mount} = { display => $mount, used => $ipercent };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue