swrd / check-mysql-all

Automatically exported from code.google.com/p/check-mysql-all
0 stars 0 forks source link

add --mmm-base #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
]

--- check_mmm-0.0.6 2009-08-13 16:12:14.000000000 -0700
+++ check_mmm   2009-08-13 16:26:29.000000000 -0700
@@ -35,6 +35,7 @@
     'cluster=s'    => \$OPTIONS{'cluster' },
     'critical|c=s' => \$OPTIONS{'critical'},
     'help|h'       => \$OPTIONS{'help'    },
+    'mmm-base=s'   => \$OPTIONS{'mmm-base'},
     'verbose|v+'   => \$OPTIONS{'verbose' },
     'version|V'    => \$OPTIONS{'version' },
     'warning|w=s'  => \$OPTIONS{'warning' } ) ) {
@@ -80,10 +81,16 @@
 # Begin the main program
 ################################################################################

-chomp(my $mmm_control = `which mmm_control`);
+chomp(my $mmm_control = $OPTIONS{'mmm-base'} ?
$OPTIONS{'mmm-base'}.'/sbin/mmm_control' : `which mmm_control 2>/dev/null`);
 $OPTIONS{'cluster'} = $OPTIONS{'cluster'} ? '@'.$OPTIONS{'cluster'} : '';
 my $mmm_cmd = $mmm_control.' '.$OPTIONS{'cluster'}.' show';

+# Verify executable was found
+if(! -x $mmm_control) {
+    print "CRITICAL: Cannot Find/Execute mmm_control\n";
+    exit $ERRORS{'CRITICAL'};
+}
+
 if ( $mmm_cmd ) {
     chomp(my $mmm_output = `$mmm_cmd`);

@@ -126,10 +133,6 @@
     }

     print "OK\n";
- 
-} else {
-    print "CRITICAL: Cannot Find/Execute mmm_control\n";
-    exit $ERRORS{'CRITICAL'};
 }

 ################################################################################
@@ -148,6 +151,7 @@

  Options:
    --cluster=<cluster_id>    The MMM Cluster to check
+   --mmm-base=<base_dir>     Base directory where MMM is installed
    -c, --critical=<limit>    The level at which a critical alarm is raised.
    -h, --help                Display this message and exit
    -v, --verbose             Increase verbosity level
@@ -161,6 +165,7 @@
  cluster                    No default value
  critical                   HARD_OFFLINE,REPLICATION_FAIL
  help                       FALSE
+ mmm-base                   No default value
  verbose                    1 (out of 3)
  version                    FALSE
  warning                    ADMIN_OFFLINE,AWAITING_RECOVERY,REPLICATION_DELAY

Original issue reported on code.google.com by ryan.a.l...@gmail.com on 14 Aug 2009 at 8:07

GoogleCodeExporter commented 8 years ago
Fixed in check_mmm 0.0.7

Original comment by ryan.a.l...@gmail.com on 15 Aug 2009 at 8:41