From: Greg Sabino Mullane Date: Sun, 25 Jan 2009 15:20:42 +0000 (-0500) Subject: Don't show service= unless there is something there X-Git-Tag: 2.9.0~194 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=f5e7bf43b3e4ee35a6a9c7b871a00328fe18841a;p=check_postgres.git Don't show service= unless there is something there --- 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 '' ? '' : 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 '' ? '' : 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}) {