Better output when hitting second database, port, or host.
authorGreg Sabino Mullane <greg@endpoint.com>
Wed, 29 Jul 2009 03:07:39 +0000 (23:07 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Wed, 29 Jul 2009 03:07:39 +0000 (23:07 -0400)
check_postgres.pl

index 062f0a522dfed9614aa296f48d6f8add612d6b44..7461d3ff78f01d880bed3a176ae5118752dd6fce 100755 (executable)
@@ -888,11 +888,17 @@ sub add_response {
 
        $db->{host} ||= '';
 
-       if (defined $opt{host2} and defined $opt{host2}->[0] and length $opt{host2}->[0]) {
+       if (defined $opt{dbname2} and defined $opt{dbname2}->[0] and length $opt{dbname2}->[0]
+               and $opt{dbname}->[0] ne $opt{dbname2}->[0]) {
+               $db->{dbname} .= " => $opt{dbname2}->[0]";
+       }
+       if (defined $opt{host2} and defined $opt{host2}->[0] and length $opt{host2}->[0]
+               and $opt{host}->[0] ne $opt{host2}->[0]) {
                $db->{host} .= " => $opt{host2}->[0]";
        }
-       if (defined $opt{port2} and defined $opt{port2}->[0] and length $opt{port2}->[0]) {
-               $db->{port} .= " => $opt{port2}->[0]";
+       if (defined $opt{port2} and defined $opt{port2}->[0] and length $opt{port2}->[0]
+               and $opt{port}->[0] ne $opt{port2}->[0]) {
+               $db->{port} .= " => $opt{port2}->[0]) ";
        }
        if ($nohost) {
                push @{$type->{''}} => [$msg, length $nohost > 1 ? $nohost : ''];