Extra test on parameters

This commit is contained in:
Quentin Delance 2014-12-15 10:20:40 +01:00
parent 0733940b0b
commit a504f95e58
1 changed files with 7 additions and 0 deletions

View File

@ -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.");