summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-01-25 15:20:42 +0000
committerGreg Sabino Mullane2009-01-25 15:20:42 +0000
commitf5e7bf43b3e4ee35a6a9c7b871a00328fe18841a (patch)
treec3ba81a493728b69cf63637ea698ec160215e1a2
parentb85610a053f3c647fa8ac62c5f3b29091e9d9ac9 (diff)
Don't show service= unless there is something there
-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}) {