fix vacuum postgres

This commit is contained in:
garnier-quentin 2020-09-10 14:00:01 +02:00
parent 3d9e702fa0
commit 043561ba9f
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); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'warning:s' => { name => 'warning', default => '' },
"warning:s" => { name => 'warning', default => ''}, 'critical:s' => { name => 'critical', default => '' },
"critical:s" => { name => 'critical', default => ''}, 'tablespace:s' => { name => 'tablespace' } # tablespace name to check
"tablespace:s" => { name => 'tablespace', }, # tablespace name to check });
});
return $self; return $self;
} }
@ -64,7 +63,7 @@ sub run {
my $target_fields = undef; my $target_fields = undef;
# Query to get tablespace size # 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); $self->{sql}->query(query => $query);
my $result = $self->{sql}->fetchrow_array(); 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) { 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}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
self->{output}->option_exit(); $self->{output}->option_exit();
} }
} }