-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRITICAL message is issued when UNDO tablespace usage % is negative #44
Comments
Potential solutionThe plan to solve the bug involves addressing the calculation logic for tablespace usage in the What is causing this bug?The bug is caused by the calculation logic in the CodeTo fix the bug, we need to modify the if ($params{mode} =~ /server::[c]*database::tablespace::(usage|free)/) {
if (! defined $self->{bytes_max} || $self->{bytes_max} eq '') {
$self->{bytes} = 0;
$self->{bytes_max} = 0;
$self->{bytes_free} = 0;
$self->{percent_used} = 0;
$self->{real_bytes_max} = $self->{bytes};
$self->{real_bytes_free} = $self->{bytes_free};
} else {
if ($params{calcmeth} eq "classic") {
if ($self->{bytes_max} == 0) {
$self->{percent_used} =
($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100;
$self->{real_bytes_max} = $self->{bytes};
$self->{real_bytes_free} = $self->{bytes_free};
} elsif ($self->{bytes_max} > $self->{bytes}) {
$self->{percent_used} =
($self->{bytes} - $self->{bytes_free}) / $self->{bytes_max} * 100;
$self->{real_bytes_max} = $self->{bytes_max};
$self->{real_bytes_free} = $self->{bytes_free} + ($self->{bytes_max} - $self->{bytes});
} else {
$self->{percent_used} =
($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100;
$self->{real_bytes_max} = $self->{bytes};
$self->{real_bytes_free} = $self->{bytes_free};
}
} elseif ($params{calcmeth} eq "vigna") {
// Vigna calculation logic here
}
}
// Ensure percent_used is not negative
if ($self->{percent_used} < 0) {
$self->{percent_used} = 0;
}
$self->{percent_free} = 100 - $self->{percent_used};
my $tlen = 20;
my $len = int((($params{mode} =~ /server::[c]*database::tablespace::usage/) ?
$self->{percent_used} : $self->{percent_free} / 100 * $tlen) + 0.5);
} How to replicate the bugTo replicate the bug, follow these steps:
By implementing the recommended changes, the script will correctly handle cases where Click here to create a Pull Request with the proposed solution Files used for this task: Changes on plugins-scripts/check_oracle_health.plAnalysis Report for
|
Duplicate issue, same as #30 |
The messages occurs regularly for the UNDO tablespace, always on the same server.
Should negative values be returned ?
CRITICAL - tbs UNDO01 usage is -0.00% | 'tbs_undo01_usage_pct'=-0.00%;80;90 'tbs_undo01_usage'=0MB;52428;58982;0;65535 'tbs_undo01_alloc'=51199MB;;;0;65535
CRITICAL - tbs UNDO01 usage is -0.02% | 'tbs_undo01_usage_pct'=-0.02%;80;90 'tbs_undo01_usage'=-9MB;52428;58982;0;65535 'tbs_undo01_alloc'=51199MB;;;0;65535
OK - no problems | 'tbs_undo01_usage_pct'=0.00%;80;90 'tbs_undo01_usage'=1MB;52428;58982;0;65535
The text was updated successfully, but these errors were encountered: