This commit is contained in:
Quentin Garnier 2015-03-04 17:27:24 +11:00
parent c479448c2c
commit 6314d19db9
3 changed files with 3 additions and 7 deletions

View File

@ -361,7 +361,7 @@ Can be: 'values' (only check numeric values)
Threshold warning if the string match
=item B<--critical-numeric>
=item B<--critical-string>
Threshold critical if the string match

View File

@ -375,7 +375,7 @@ Can be: 'values' (only check numeric values)
Threshold warning if the string match
=item B<--critical-numeric>
=item B<--critical-string>
Threshold critical if the string match

View File

@ -80,17 +80,13 @@ sub init {
@{$self->{sqldefault}->{dbi}} = ();
@{$self->{sqldefault}->{psqlcmd}} = ();
for (my $i = 0; $i < scalar(@{$options_result->{db_host}}); $i++) {
if (!defined($options_result->{db_name}[$i]) || $options_result->{db_name}[$i] eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify database argument.");
$self->{output}->option_exit();
}
$self->{sqldefault}->{dbi}[$i] = { data_source => 'Pg:host=' . $options_result->{db_host}[$i] };
$self->{sqldefault}->{psqlcmd}[$i] = { host => $options_result->{db_host}[$i] };
if (defined($options_result->{db_port}[$i])) {
$self->{sqldefault}->{dbi}[$i]->{data_source} .= ';port=' . $options_result->{db_port}[$i];
$self->{sqldefault}->{psqlcmd}[$i]->{port} = $options_result->{db_port}[$i];
}
$options_result->{db_name}[$i] = (defined($options_result->{db_name}[$i])) ? $options_result->{db_name}[$i] : 'postgres';
$options_result->{db_name}[$i] = (defined($options_result->{db_name}[$i]) && $options_result->{db_name}[$i] ne '') ? $options_result->{db_name}[$i] : 'postgres';
$self->{sqldefault}->{dbi}[$i]->{data_source} .= ';database=' . $options_result->{db_name}[$i];
$self->{sqldefault}->{psqlcmd}[$i]->{dbname} = $options_result->{db_name}[$i];
}