From 5546b05a3dc8b40267d8368fa7daab5060fe8959 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 3 Apr 2019 16:50:22 +0200 Subject: [PATCH] Fix #1462 --- centreon/plugins/output.pm | 17 +++++++++-------- os/aix/local/mode/inodes.pm | 16 +++++++++++----- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/centreon/plugins/output.pm b/centreon/plugins/output.pm index a3951bb88..b52a751bd 100644 --- a/centreon/plugins/output.pm +++ b/centreon/plugins/output.pm @@ -209,14 +209,15 @@ sub output_json { my ($self, %options) = @_; 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 $json_content = {plugin => { - name => $self->{plugin}, - mode => $self->{mode}, - exit => $options{exit_litteral}, - outputs => [], - perfdatas => [] - } - }; + my $json_content = { + plugin => { + name => $self->{plugin}, + mode => $self->{mode}, + exit => $options{exit_litteral}, + outputs => [], + perfdatas => [] + } + }; foreach my $code_litteral (keys %{$self->{global_short_outputs}}) { foreach (@{$self->{global_short_outputs}->{$code_litteral}}) { diff --git a/os/aix/local/mode/inodes.pm b/os/aix/local/mode/inodes.pm index a38c782b0..f078e3f02 100644 --- a/os/aix/local/mode/inodes.pm +++ b/os/aix/local/mode/inodes.pm @@ -95,9 +95,18 @@ sub manage_selection { # Header not needed shift @lines; foreach my $line (@lines) { - next if ($line !~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/); - my ($fs, $size, $available, $percent, $iused, $ipercent, $mount) = ($1, $2, $3, $4, $5, $6, $7); + # Can be very different. + #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 '' && $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}) && $mount ne $self->{option_results}->{name}); - next if ($iused !~ m/^\d+$/); - - $ipercent =~ s/%//g; $self->{inodes}->{$mount} = { display => $mount, used => $ipercent }; }