diff --git a/centreon-plugins/database/oracle/mode/dataguard.pm b/centreon-plugins/database/oracle/mode/dataguard.pm index 1df915fe2..4d47b9b6b 100644 --- a/centreon-plugins/database/oracle/mode/dataguard.pm +++ b/centreon-plugins/database/oracle/mode/dataguard.pm @@ -61,7 +61,7 @@ sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ - { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + { name => 'global', type => 0, skipped_code => { -10 => 1 } } ]; $self->{maps_counters}->{global} = [ @@ -74,17 +74,17 @@ sub set_counters { closure_custom_calc => $self->can('custom_status_calc'), closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => \&catalog_status_threshold, + closure_custom_threshold_check => \&catalog_status_threshold } }, { label => 'standby-lag', nlabel => 'dataguard.standby.lag.minutes', set => { key_values => [ { name => 'lag_minutes' } ], output_template => 'dataguard standby lag %d minutes: %s', perfdatas => [ - { value => 'lag_minutes', template => '%s', min => 0, unit => 'm' }, - ], + { template => '%s', min => 0, unit => 'm' } + ] } - }, + } ]; } @@ -147,21 +147,22 @@ sub manage_selection { $options{sql}->query( query => q{ - SELECT - TO_CHAR(MAX(first_time),'YYYYMMDDHH24MISS'), - CEIL((SYSDATE - MAX(first_time)) * 24 * 60) - FROM - v$archived_log - WHERE - applied NOT IN ('NO') AND registrar = 'RFS' + SELECT round( + extract(DAY from cast(value AS INTERVAL DAY TO SECOND)) * 1440 + + extract(HOUR from cast(value AS INTERVAL DAY TO SECOND)) * 60 + + extract(MINUTE from cast(value AS INTERVAL DAY TO SECOND)) + + extract(SECOND from cast(value AS INTERVAL DAY TO SECOND)) / 60, + 0 + ) AS "Lag minutes" + from v$dataguard_stats where NAME='apply lag' } ); @result = $options{sql}->fetchrow_array(); - $self->{global}->{lag_minutes} = defined($result[1]) && $result[1] ne '' ? $result[1] : -1; + $self->{global}->{lag_minutes} = defined($result[0]) && $result[0] ne '' ? $result[0] : -1; $options{sql}->disconnect(); - $self->{cache_name} = "oracle_" . $self->{mode} . '_' . $options{sql}->get_unique_id4save() . '_' . + $self->{cache_name} = 'oracle_' . $self->{mode} . '_' . $options{sql}->get_unique_id4save() . '_' . (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); } diff --git a/centreon-plugins/database/oracle/mode/rollbacksegmentusage.pm b/centreon-plugins/database/oracle/mode/rollbacksegmentusage.pm index 7684ae11f..afe903c2c 100644 --- a/centreon-plugins/database/oracle/mode/rollbacksegmentusage.pm +++ b/centreon-plugins/database/oracle/mode/rollbacksegmentusage.pm @@ -38,16 +38,16 @@ sub set_counters { key_values => [ { name => 'extends', per_second => 1 } ], output_template => 'Extends : %.2f/s', perfdatas => [ - { label => 'extends', template => '%.2f', unit => '/s', min => 0 }, - ], + { label => 'extends', template => '%.2f', unit => '/s', min => 0 } + ] } }, { label => 'wraps', set => { key_values => [ { name => 'wraps', per_second => 1 } ], output_template => 'Wraps : %.2f/s', perfdatas => [ - { label => 'wraps', template => '%.2f', unit => '/s', min => 0 }, - ], + { label => 'wraps', template => '%.2f', unit => '/s', min => 0 } + ] } }, { label => 'header-contention', set => { @@ -55,8 +55,8 @@ sub set_counters { closure_custom_calc => $self->can('custom_contention_calc'), closure_custom_calc_extra_options => { label_ref => 'header' }, output_template => 'Header Contention : %.2f %%', output_use => 'header_prct', threshold_use => 'header_prct', perfdatas => [ - { label => 'header_contention', value => 'header_prct', template => '%.2f', min => 0, max => 100, unit => '%' }, - ], + { label => 'header_contention', value => 'header_prct', template => '%.2f', min => 0, max => 100, unit => '%' } + ] } }, { label => 'block-contention', set => { @@ -64,8 +64,8 @@ sub set_counters { closure_custom_calc => $self->can('custom_contention_calc'), closure_custom_calc_extra_options => { label_ref => 'block' }, output_template => 'Block Contention : %.2f %%', output_use => 'block_prct', threshold_use => 'block_prct', perfdatas => [ - { label => 'block_contention', value => 'block_prct', template => '%.2f', min => 0, max => 100, unit => '%' }, - ], + { label => 'block_contention', value => 'block_prct', template => '%.2f', min => 0, max => 100, unit => '%' } + ] } }, { label => 'hit-ratio', set => { @@ -73,10 +73,10 @@ sub set_counters { closure_custom_calc => $self->can('custom_hitratio_calc'), output_template => 'gets/waits Ratio : %.2f %%', output_use => 'hit_ratio', threshold_use => 'hit_ratio', perfdatas => [ - { label => 'hit_ratio', value => 'hit_ratio', template => '%.2f', min => 0, max => 100, unit => '%' }, - ], + { label => 'hit_ratio', value => 'hit_ratio', template => '%.2f', min => 0, max => 100, unit => '%' } + ] } - }, + } ]; }