|| $HOSTS_DEFAULTS{'mysql'}{'dbuser'};
my( $dbpass ) = $HOSTS{$host}{'mysql'}{'dbpass'}
|| $HOSTS_DEFAULTS{'mysql'}{'dbpass'};
+ my( $dbport ) = $HOSTS{$host}{'mysql'}{'dbport'}
+ || $HOSTS_DEFAULTS{'mysql'}{'dbport'};
my( $color, $summary, $message ) = ( "green", "MySQL Ok", "" );
- open (MYSQL,"$MYSQLADMIN $host status -u$dbuser -p$dbpass 2>&1 |") || warn "Could not exec $MYSQLADMIN for status info.";
+ $dbport = "-P $dbport" if ($dbport);
+
+ open (MYSQL,"$MYSQLADMIN $host $dbport status -u$dbuser -p$dbpass 2>&1 |") || warn "Could not exec $MYSQLADMIN for status info.";
while (<MYSQL>) {
$message .= $_;
if (/Can\'t connect/) {
%HOSTS_DEFAULTS = (
'mysql' => {
'dbuser' => 'spong',
- 'dbpass' => 'default-password'
+ 'dbpass' => 'default-password',
}
)
'mysql.server.com' => {
'services' => 'mysql',
'mysql' => {
- 'dbpass' => 'host-specific-password'
+ 'dbpass' => 'host-specific-password',
+ 'dbport' => 'host-specific-port-number',
}
}
Support for %HOSTS and %HOSTS_DEFAULTS and POD documentation added by
Andrew Ruthven <andrew@etc.gen.nz> - 2002/06/13.
+Support for alternate port definitions added by
+Alan Premselaar <alien@12inch.com> - 2005/09/30.