[Nagiosplug-help] check mysql.pl

Warner, Randy rwarner at rightnow.com
Mon Apr 28 10:50:09 CEST 2003


Tried this, same result.

The script is successful when run from the command line, yet returns
CRITICAL when run via Nagios.

--Randy

-----Original Message-----
From: Lukasz Lesniak [mailto:lukebfth at tlen.pl] 
Sent: Monday, April 28, 2003 1:30 PM
To: "\"Warner"@go2.pl; Warner, Randy
Subject: Re: [Nagiosplug-help] check mysql.pl

Maybe use mysqladmin -h host -u user --
password="mysecretpass"

Replace -p for --password

luke.


"Warner, Randy" <rwarner at rightnow.com>:

>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;
>
>};
>
>





More information about the Help mailing list