Added support for specific maxadmin path

Added support for specific maxadmin path
This commit is contained in:
MassimilianoPinto
2015-03-06 18:15:14 +01:00
parent 84f00cfe36
commit b2cee0ae18
6 changed files with 50 additions and 14 deletions

View File

@ -72,17 +72,21 @@ EOF
'P' => 6603, # port
'm' => '/usr/local/skysql/maxscale/bin/maxadmin', # maxadmin
);
my $MAXADMIN_DEFAULT = $opts{'m'};
getopts('r:hH:u:p:P:m:', \%opts)
or usage( $ERRORS{"UNKNOWN"} );
usage( $ERRORS{'OK'} ) if $opts{'h'};
my $MAXADMIN_RESOURCE = $opts{'r'};
my $MAXADMIN = $opts{'m'};
if (!defined $MAXADMIN || length($MAXADMIN) == 0) {
$MAXADMIN = $MAXADMIN_DEFAULT;
}
-x $MAXADMIN or
die "$curr_script: Failed to find required tool: $MAXADMIN. Please install it or use the -m option to point to another location.";
my ( $state, $status ) = ( "OK", 'maxadmin ' . $MAXADMIN_RESOURCE .' succeeds.' );
# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
print ("UNKNOWN: No response from MaxScale server (alarm)\n");
@ -122,7 +126,7 @@ my $start_queue_len = 0;
while ( <MAXSCALE> ) {
chomp;
if ( /Unable to connect to MaxScale/ ) {
if ( /(Failed|Unable) to connect to MaxScale/ ) {
printf "CRITICAL: $_\n";
close(MAXSCALE);
exit(2);