[Nagiosplug-help] check_mysql_query

kyle smith kyles at apple.com
Sat Jun 14 20:00:09 CEST 2008


Here's how i would get this working:

on machine where db lives (your nagios client):
1 - install the nagios plugins and NRPE

2 - make sure the check_mysql_query plugin works as you expect by  
running it locally (no -H necessary, use both -w and -c params in  
same plugin call):

% /usr/nagios/libexec/check_mysql_query -q 'Select count(*) from  
table" -w 1:5 -c 2000000 -P 3306 -u test -p example
<see results here>

3 - once you get this working exactly as you want it to you need to  
define a command to use it in the nrpe.cfg file, you have to create a  
command name different than the plugin name in your assignment:

command[my_new_command_name]=/usr/nagios/libexec/check_mysql_query -q  
'Select count(*) from table" -w 1:5 -c 2000000 -P 3306 -u test -p  

4 - startup nrpe daemon

% /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

5 - verify check_nrpe plugin and NRPE daemon talking ok

% /usr/nagios/libexec/check_nrpe -H localhost
NRPE v2.11

6 - verify the command you just set up works ok through check_nrpe  

% /usr/local/nagios/libexec/libexec/check_nrpe -H localhost -c  
<see those same results here>

Now you need to go to your nagios server and get this working from  
there. I assume you already have setup this client as a host to the  
system and nagios is running a ping test on it.

7 - install check_nrpe plugin

8 - define command to use check_nrpe in your commands.cfg file

define command {
	command_name    check_nrpe
	command_line    /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS 
$ -c $ARG1$

9 - verify communication with the NRPE daemon on your remote client

/usr/local/nagios/libexec/check_nrpe -H  
<remote_client_IP_address>NRPE v2.11

10 - execute your newly defined command on the remote client through  
the check_nrpe plugin here on the server

/usr/local/nagios/libexec/check_nrpe -H  <remote_client_IP_address> - 
c my_new_command_name<see same results here>

11 - define a service to use this new command you just setup:

define service{
	use		remote-service
	host_name	<client host name as defined in nagios host.cfg>
	service_description     MySQL check for rowcount on table blah
	check_command           check_nrpe!my_new_command_name

12 - restart nagios and away you go!



On Jun 14, 2008, at 1:16 AM, Kaushal Shriyan wrote:

> Hi,
> I want to set a nagios alert whenever the count(*) of a specific  
> table in test DB (MySQL) on a specific host crosses 200000 using  
> mysql_check_query
> plugin
> I have referred to http://nagiosplugins.org/man/check_mysql_query  
> for -w and -c option
> which says -w, --warning=RANGE Warning range (format: start:end).  
> Alert if outside this range
>                 -c, --critical=RANGE
> How can i set this in nagios(nrpe.cfg) on the remote host.
> Any example would be really helpful
> I have set it like the below in the nrpe.cfg file
> command[check_mysql_query]=/usr/nagios/libexec/check_mysql_query -q  
> "Select count(*) from table" -w1:5 -H localhost -P 3306 -d test -u  
> test -p example
> command[check_mysql_query]=/usr/nagios/libexec/check_mysql_query -q  
> "Select count(*) from table" -c200000 -H localhost -P 3306 -d test - 
> u test -p example
> Not sure if the above command is right.
> Any ideas
> Thanks and Regards
> Kaushal
> ---------------------------------------------------------------------- 
> ---
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/ 
> index.php_______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any  
> issue.
> ::: Messages without supporting info will risk being sent to /dev/null

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

More information about the Help mailing list