summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-07-29 03:07:39 +0000
committerGreg Sabino Mullane2009-07-29 03:07:39 +0000
commit1e52bc041ac27267cdaf157b27a4d4eb1bb13f6d (patch)
tree83fb64acf8ee2150465bca62ff5e393d7ba0167b /check_postgres.pl
parent658f3957b839a8b130b00e7a0df81a1b0422491a (diff)
Better output when hitting second database, port, or host.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 062f0a522..7461d3ff7 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -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 : ''];