[check_postgres] [commit] Don't show service= unless there is something there

check_postgres at bucardo.org check_postgres at bucardo.org
Sun Jan 25 20:43:04 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Don't show service= unless there is something there

---
 check_postgres.pl |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/check_postgres.pl b/check_postgres.pl
index 6a8f2fc..a20a6ee 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}) {
-- 
1.6.0.5



More information about the Check_postgres mailing list