From a504f95e58d0e26b246903c664941d5cebc0b06d Mon Sep 17 00:00:00 2001 From: Quentin Delance Date: Mon, 15 Dec 2014 10:20:40 +0100 Subject: [PATCH] Extra test on parameters --- centreon-plugins/database/postgres/mode/vacuum.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/centreon-plugins/database/postgres/mode/vacuum.pm b/centreon-plugins/database/postgres/mode/vacuum.pm index 754adc888..7e362d047 100644 --- a/centreon-plugins/database/postgres/mode/vacuum.pm +++ b/centreon-plugins/database/postgres/mode/vacuum.pm @@ -67,6 +67,10 @@ sub check_options { $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); $self->{output}->option_exit(); } + if (($self->{perfdata}->threshold_validate(label => 'dbname', value => $self->{option_results}->{dbname})) eq 'postgres') { + $self->{output}->add_option_msg(short_msg => "Invalid db."); + $self->{output}->option_exit(); + } } @@ -85,6 +89,9 @@ sub run { if ($1 eq 'postgres') { $self->{output}->add_option_msg(short_msg => "Cannot use system 'postgres' database ; you must use a real database."); $self->{output}->option_exit(); + } elsif ($1 eq '') { + $self->{output}->add_option_msg(short_msg => "Database must be specified."); + $self->{output}->option_exit(); } } else { $self->{output}->add_option_msg(short_msg => "Need to specify database argument.");