mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 16:14:21 +02:00
(plugin) database::oracle - mode dataguard use dataguard_stats view for lag time (#3475)
This commit is contained in:
parent
5db54d8228
commit
b5d24ec1e1
@ -61,7 +61,7 @@ sub set_counters {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
|
{ name => 'global', type => 0, skipped_code => { -10 => 1 } }
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
@ -74,17 +74,17 @@ sub set_counters {
|
|||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
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 => {
|
{ label => 'standby-lag', nlabel => 'dataguard.standby.lag.minutes', set => {
|
||||||
key_values => [ { name => 'lag_minutes' } ],
|
key_values => [ { name => 'lag_minutes' } ],
|
||||||
output_template => 'dataguard standby lag %d minutes: %s',
|
output_template => 'dataguard standby lag %d minutes: %s',
|
||||||
perfdatas => [
|
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(
|
$options{sql}->query(
|
||||||
query => q{
|
query => q{
|
||||||
SELECT
|
SELECT round(
|
||||||
TO_CHAR(MAX(first_time),'YYYYMMDDHH24MISS'),
|
extract(DAY from cast(value AS INTERVAL DAY TO SECOND)) * 1440
|
||||||
CEIL((SYSDATE - MAX(first_time)) * 24 * 60)
|
+ extract(HOUR from cast(value AS INTERVAL DAY TO SECOND)) * 60
|
||||||
FROM
|
+ extract(MINUTE from cast(value AS INTERVAL DAY TO SECOND))
|
||||||
v$archived_log
|
+ extract(SECOND from cast(value AS INTERVAL DAY TO SECOND)) / 60,
|
||||||
WHERE
|
0
|
||||||
applied NOT IN ('NO') AND registrar = 'RFS'
|
) AS "Lag minutes"
|
||||||
|
from v$dataguard_stats where NAME='apply lag'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@result = $options{sql}->fetchrow_array();
|
@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();
|
$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'));
|
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,16 +38,16 @@ sub set_counters {
|
|||||||
key_values => [ { name => 'extends', per_second => 1 } ],
|
key_values => [ { name => 'extends', per_second => 1 } ],
|
||||||
output_template => 'Extends : %.2f/s',
|
output_template => 'Extends : %.2f/s',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'extends', template => '%.2f', unit => '/s', min => 0 },
|
{ label => 'extends', template => '%.2f', unit => '/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'wraps', set => {
|
{ label => 'wraps', set => {
|
||||||
key_values => [ { name => 'wraps', per_second => 1 } ],
|
key_values => [ { name => 'wraps', per_second => 1 } ],
|
||||||
output_template => 'Wraps : %.2f/s',
|
output_template => 'Wraps : %.2f/s',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'wraps', template => '%.2f', unit => '/s', min => 0 },
|
{ label => 'wraps', template => '%.2f', unit => '/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'header-contention', set => {
|
{ 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' },
|
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',
|
output_template => 'Header Contention : %.2f %%', output_use => 'header_prct', threshold_use => 'header_prct',
|
||||||
perfdatas => [
|
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 => {
|
{ 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' },
|
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',
|
output_template => 'Block Contention : %.2f %%', output_use => 'block_prct', threshold_use => 'block_prct',
|
||||||
perfdatas => [
|
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 => {
|
{ label => 'hit-ratio', set => {
|
||||||
@ -73,10 +73,10 @@ sub set_counters {
|
|||||||
closure_custom_calc => $self->can('custom_hitratio_calc'),
|
closure_custom_calc => $self->can('custom_hitratio_calc'),
|
||||||
output_template => 'gets/waits Ratio : %.2f %%', output_use => 'hit_ratio', threshold_use => 'hit_ratio',
|
output_template => 'gets/waits Ratio : %.2f %%', output_use => 'hit_ratio', threshold_use => 'hit_ratio',
|
||||||
perfdatas => [
|
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 => '%' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user