From: Jan Willamowius Date: Fri, 30 Sep 2005 08:37:10 +0000 (+0000) Subject: allow configuration of the MySQL port (patch by Alan) X-Git-Tag: spong-2_8_0-beta2~1 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e64df34f06fc46c308dd30912e4d5beb2034b5eb;p=spong.git allow configuration of the MySQL port (patch by Alan) --- diff --git a/src/lib/Spong/Network/plugins/check_mysql b/src/lib/Spong/Network/plugins/check_mysql index cb59dc1..3ce59d0 100755 --- a/src/lib/Spong/Network/plugins/check_mysql +++ b/src/lib/Spong/Network/plugins/check_mysql @@ -23,9 +23,13 @@ sub check_mysql { || $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 () { $message .= $_; if (/Can\'t connect/) { @@ -87,7 +91,7 @@ then for specific hosts. An example is given in L. %HOSTS_DEFAULTS = ( 'mysql' => { 'dbuser' => 'spong', - 'dbpass' => 'default-password' + 'dbpass' => 'default-password', } ) @@ -95,7 +99,8 @@ then for specific hosts. An example is given in L. 'mysql.server.com' => { 'services' => 'mysql', 'mysql' => { - 'dbpass' => 'host-specific-password' + 'dbpass' => 'host-specific-password', + 'dbport' => 'host-specific-port-number', } } @@ -117,3 +122,5 @@ Miles Lott Support for %HOSTS and %HOSTS_DEFAULTS and POD documentation added by Andrew Ruthven - 2002/06/13. +Support for alternate port definitions added by +Alan Premselaar - 2005/09/30.