(plugin) database::oracle - mode dataguard use dataguard_stats view for lag time (#3475)

This commit is contained in:
qgarnier 2022-02-09 11:28:52 +01:00 committed by GitHub
parent c89ee8d244
commit 5558adc5a4
2 changed files with 26 additions and 25 deletions

View File

@ -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'));
}

View File

@ -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 => '%' }
]
}
},
}
];
}