summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 6a8f2fc30..a20a6ee9e 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -356,9 +356,10 @@ sub add_response {
my ($type,$msg) = @_;
my $header = sprintf q{%s%s%s},
- $action_info->{$action}[0] ? '' : defined $db->{dbservice} ? qq{service=$db->{dbservice} } : qq{DB "$db->{dbname}" },
- $db->{host} eq '<none>' ? '' : qq{(host:$db->{host}) },
- defined $db->{port} ? ($db->{port} eq $opt{defaultport} ? '' : qq{(port=$db->{port}) }) : '';
+ $action_info->{$action}[0] ? '' : (defined $db->{dbservice} and length $db->{dbservice}) ?
+ qq{service=$db->{dbservice} } : qq{DB "$db->{dbname}" },
+ $db->{host} eq '<none>' ? '' : qq{(host:$db->{host}) },
+ defined $db->{port} ? ($db->{port} eq $opt{defaultport} ? '' : qq{(port=$db->{port}) }) : '';
$header =~ s/\s+$//;
my $perf = ($opt{showtime} and $db->{totaltime}) ? "time=$db->{totaltime}" : '';
if ($db->{perf}) {