[Nagiosplug-help] check_mysql.pl

Warner, Randy rwarner at rightnow.com
Mon Apr 28 10:11:12 CEST 2003


I have this plugin running successfully from the command line, but
running through Nagios, the plugin returns a CRITICAL state.  I've
altered the plugin to accept a port argument.  Any help would be
appreciated.

 

Here is the code.

 

#!/usr/bin/perl -w

 

use strict;

 

use Getopt::Std;

 

use vars qw(%opts $host $port $temp);

 

getopts('h:p:',\%opts);

 

unless ( ($opts{h}) ) { print "ERROR: no host given!\n";

exit 3;}

 

my $host = $opts{h};

my $port = $opts{p};

 

$temp = `mysqladmin -h $host -P $port -s -u user -p****** version | wc
-l`;

 

if ($temp == 0) {

 print "CRITICAL -  no response from server!\n";

exit 2;

};

 

if ($temp > 0) {

 print "MYSQL OK: server responding on port $port\n";

 exit 0;

};

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20030428/75287faa/attachment.html>


More information about the Help mailing list