--- pgsql.monitor 2002/07/10 08:50:00 1.2 +++ pgsql.monitor 2002/07/10 09:26:32 1.3 @@ -70,11 +70,29 @@ die(); } +my @test_db; + +foreach (@ARGV) { + if (m/^([^:]+):([^\@]+)\@(.+)/) { + push + %test[host] = $1; + %test[user] = $2; + %test + my ($host,$user,$database) = ($1,$2,$3); + } else { + push @failures, "Can't parse configuration: host '$_' not in host:user\@database format!"; + } +} my( $dbh ) = DBI->connect( "DBI:$mode:dbname=$options{database};$options{host};$options{port}", $options{username}, $options{password} ); if( ! $dbh ) { push( @failures, "Could not connect to $mode server $host: " . $DBI::errstr ); +} else { + my $sth = $dbh -> prepare("select count(*) from pg_tables"); } + + + if (@failures) { print join (", ", @failures), "\n"; exit 1;