fix vacuum postgres

This commit is contained in:
garnier-quentin 2020-09-10 14:00:01 +02:00
parent f6896d1bb6
commit 4e9a759243
2 changed files with 7 additions and 8 deletions

View File

@ -30,12 +30,11 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning', default => ''},
"critical:s" => { name => 'critical', default => ''},
"tablespace:s" => { name => 'tablespace', }, # tablespace name to check
});
$options{options}->add_options(arguments => {
'warning:s' => { name => 'warning', default => '' },
'critical:s' => { name => 'critical', default => '' },
'tablespace:s' => { name => 'tablespace' } # tablespace name to check
});
return $self;
}
@ -64,7 +63,7 @@ sub run {
my $target_fields = undef;
# Query to get tablespace size
my $query = sprintf("SELECT pg_tablespace_size('%s') FROM pg_tablespace LIMIT 1;",$self->{option_results}->{tablespace});
my $query = sprintf("SELECT pg_tablespace_size('%s') FROM pg_tablespace LIMIT 1;", $self->{option_results}->{tablespace});
$self->{sql}->query(query => $query);
my $result = $self->{sql}->fetchrow_array();

View File

@ -48,7 +48,7 @@ sub check_options {
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
self->{output}->option_exit();
$self->{output}->option_exit();
}
}