I have made the following change to the msql-mysql.monitor, maybe it
will be helpful to others:
Purpose:
Ability to check more that one db on the db server.
Arguments:
Same as always except --database=database can also be
--database=database1:database2:database3...
database can now contain multiple db names seperated by a : character.
The main for loop now looks like this (I'm not familiard with Perl DBI
so this may be inefficient?):
@db_list = split /:/, $options{database};
for $host( @ARGV ) {
for $a_db( @db_list) {
my( $dbh ) = DBI->connect(
"DBI:$mode:$a_db:$host:$options{port}", $options{username},
$options{password} );
if( ! $dbh ) {
push( @failures, "Could not connect to $mode
server $host:$a_db: " . $DBI::errstr );
next;
}
#@tables = $dbh->func( '_ListTables' );
@tables = $dbh->tables();
if( $#tables < 0 ) {
push( @failures, "No tables found for database
$a_db on server $host" );
}
$dbh->disconnect();
}
}
-ab