From b1bceface3156dd73f88071ed268dcb06960f9e7 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 25 Sep 2019 13:20:43 +0200 Subject: [PATCH] update fra-usage for oracle 10 --- .../database/oracle/mode/frausage.pm | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/centreon-plugins/database/oracle/mode/frausage.pm b/centreon-plugins/database/oracle/mode/frausage.pm index 8a94294e4..5e164362b 100644 --- a/centreon-plugins/database/oracle/mode/frausage.pm +++ b/centreon-plugins/database/oracle/mode/frausage.pm @@ -76,26 +76,36 @@ sub manage_selection { my ($self, %options) = @_; $options{sql}->connect(); - $options{sql}->query(query => q{ - SELECT file_type, percent_space_used, percent_space_reclaimable - FROM v$recovery_area_usage - }); + if ($self->{sql}->is_version_minimum(version => '11')) { + $options{sql}->query(query => q{ + SELECT file_type, percent_space_used, percent_space_reclaimable + FROM v$recovery_area_usage + }); + } else { + $options{sql}->query(query => q{ + SELECT name, space_used, space_reclaimable, space_limit + FROM v$recovery_file_dest + }); + } my $result = $options{sql}->fetchall_arrayref(); $options{sql}->disconnect(); $self->{file} = {}; foreach my $row (@$result) { if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' && - $$row[0] !~ /$self->{option_results}->{filter_type}/i) { - $self->{output}->output_add(long_msg => "skipping '" . $$row[0] . "': no matching filter.", debug => 1); + $row->[0] !~ /$self->{option_results}->{filter_type}/i) { + $self->{output}->output_add(long_msg => "skipping '" . $row->[0] . "': no matching filter.", debug => 1); next; } - - $self->{file}->{$$row[0]} = { - display => $$row[0], - percent_space_usage => $$row[1], - percent_space_reclaimable => $$row[2], - }; + + $self->{file}->{$row->[0]} = { display => $row->[0] }; + if ($self->{sql}->is_version_minimum(version => '11')) { + $self->{file}->{$row->[0]}->{percent_space_usage} = $row->[1]; + $self->{file}->{$row->[0]}->{percent_space_reclaimable} = $row->[2]; + } else { + $self->{file}->{$row->[0]}->{percent_space_usage} = $row->[1] * 100 / $row->[3]; + $self->{file}->{$row->[0]}->{percent_space_reclaimable} = $row->[2] * 100 / $row->[3]; + } } if (scalar(keys %{$self->{file}}) <= 0) {