enhance indent

This commit is contained in:
garnier-quentin 2020-04-01 17:39:51 +02:00
parent d27ab27468
commit 530888addf
1 changed files with 37 additions and 29 deletions

View File

@ -32,10 +32,10 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
"skip-no-backup" => { name => 'skip_no_backup', },
"filter-type:s" => { name => 'filter_type', },
"timezone:s" => { name => 'timezone', },
"incremental-level" => { name => 'incremental_level', },
'skip-no-backup' => { name => 'skip_no_backup', },
'filter-type:s' => { name => 'filter_type', },
'timezone:s' => { name => 'timezone', },
'incremental-level' => { name => 'incremental_level', },
});
foreach (('db incr', 'db full', 'archivelog', 'controlfile')) {
@ -141,7 +141,7 @@ sub run {
hour => $values[2],
minute => $values[1],
second => $values[0],
time_zone => 'UTC',
time_zone => 'UTC'
);
my $offset = $last_time - $dt->epoch;
$last_time = $last_time + $offset;
@ -152,29 +152,37 @@ sub run {
my $type_perfdata = $type;
$type_perfdata =~ s/ /_/g;
$self->{output}->output_add(long_msg => sprintf("Last Rman '%s' backups : %s", $type, $backup_age_convert));
$self->{output}->perfdata_add(label => sprintf('%s_backup_age', $type_perfdata),
$self->{output}->perfdata_add(
label => sprintf('%s_backup_age', $type_perfdata),
value => $backup_age,
unit => 's',
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $label),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $label),
min => 0);
min => 0
);
my $exit_code = $self->{perfdata}->threshold_check(value => $backup_age, threshold => [ { label => 'critical-' . $label, exit_litteral => 'critical' }, { label => 'warning-' . $label, exit_litteral => 'warning' } ]);
if (!$self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("Last Rman '%s' backups : %s", $type, $backup_age_convert));
$self->{output}->output_add(
severity => $exit_code,
short_msg => sprintf("Last Rman '%s' backups : %s", $type, $backup_age_convert)
);
}
}
if ($executed == 0 && !defined($self->{option_results}->{'no-' . $label})) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("Rman '%s' backups never executed", uc($_)));
$self->{output}->output_add(
severity => 'CRITICAL',
short_msg => sprintf("Rman '%s' backups never executed", uc($_))
);
}
}
if (($count_backups == 0) && (!defined($self->{option_results}->{skip_no_backup}))) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("Rman backups never executed."));
$self->{output}->output_add(
severity => 'CRITICAL',
short_msg => sprintf("Rman backups never executed.")
);
}
$self->{output}->display();