Hi Kyle,<br><br>My Question was 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<br><br>whats the best range to be given to -w option if i give the value for -c option as -c 200000 in the below query<br><br>as the info page for -w option says -w, --warning=RANGE Warning range (format: start:end). Alert if outside this range<br>
<br><font color="#000000"><font face="Courier">/usr/nagios/libexec/check_mysql_query -q 'Select count(*) from table" -w -c </font></font>200000<font color="#000000"><font face="Courier"> -P 3306 -u test -p example</font></font><br>
<br>Hope it is clear this time<br><br>Awaiting your earnest reply<br><br>Thanks and Regards<br><br>Kaushal <br><br>On Sat, Jun 14, 2008 at 11:30 PM, kyle smith <<a href="mailto:kyles@apple.com">kyles@apple.com</a>> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">
Hello,<div><br></div><div>Here's how i would get this working:</div><div><br></div><div>on machine where db lives (your nagios client):</div><div>1 - install the nagios plugins and NRPE</div><div><br></div><div>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):</div>
<div><br></div><div><font color="#000000"><font face="Courier">% /usr/nagios/libexec/check_mysql_query -q 'Select count(*) from table" -w 1:5 -c 2000000 -P 3306 -u test -p example</font></font></div><div><see results here></div>
<div></div></div></blockquote><div><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><div><br></div><div>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:</div>
<div><br></div><div><font color="#000000"><font face="Courier">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 example</font></font></div>
<div><br></div><div>4 - startup nrpe daemon</div><div><br></div><div><div style="margin: 0px;"><font size="4"><span style="font-size: 16px;"><div style="margin: 0px;"><font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">% /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d</span></font></font></font></div>
<div style="margin: 0px;"><font size="4"><span style="font-size: 15px;"><br></span></font></div><div style="margin: 0px;"><font size="4"><span style="font-size: 15px;">5 - verify check_nrpe plugin and <span style="font-size: 14px;">NRPE</span> daemon talking ok</span></font></div>
<div style="margin: 0px;"><font size="4"><span style="font-size: 15px;"><br></span></font></div><div style="margin: 0px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">% /usr/nagios/libexec/check_nrpe -H localhost</span></font></font></div>
<div style="margin: 0px; font-size: 15px;"><font style="font-size: 16px;" size="4"><span style="font-size: 14px;">NRPE v2.11</span></font></div><div style="margin: 0px;"><font size="4"><span style="font-size: 15px;"><br></span></font></div>
<div style="margin: 0px;"><font size="4"><span style="font-size: 15px;">6 - verify the command you just set up works ok through check_nrpe plugin</span></font></div><div style="margin: 0px;"><font size="4"><span style="font-size: 15px;"><br>
</span></font></div><div style="margin: 0px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">% /usr/local/nagios/</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">libexec/</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">libexec/check_nrpe -H localhost -c my_new_command_name</span></font></font></div>
</span></font></div></div><div><see those same results here></div><div><br></div><div>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. </div>
<div><br></div><div>7 - install check_nrpe plugin</div><div><br></div><div>8 - define command to use check_nrpe in your commands.cfg file</div><div><br></div><div><font color="#000000"><font face="Courier">define command {</font></font><font color="#000000"><font face="Courier"></font></font></div>
<div><font color="#000000"><font face="Courier"><span style="white-space: pre;"> </span>command_name check_nrpe</font></font><font color="#000000"><font face="Courier"></font></font></div><div><font color="#000000"><font face="Courier"><span style="white-space: pre;"> </span>command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$</font></font><font color="#000000"><font face="Courier"></font></font></div>
<div><font color="#000000"><font face="Courier">}</font></font><br><br></div><div>9 - verify communication with the NRPE daemon on your remote client<br><font color="#000000"><font face="Courier"><br></font></font></div><div>
<font color="#000000"><font face="Courier">/usr/local/nagios/libexec/check_nrpe -H <remote_client_IP_address></font></font>NRPE v2.11<br><br></div><div>10 - execute your newly defined command on the remote client through the check_nrpe plugin here on the server<br>
<font color="#000000"><font face="Courier"><br></font></font></div><div><font color="#000000"><font face="Courier">/usr/local/nagios/</font></font><font color="#000000"><font face="Courier">libexec/</font></font><font color="#000000"><font face="Courier">check_nrpe -H </font></font><font color="#000000"><font face="Courier"><remote_client_IP_address> </font></font><font color="#000000"><font face="Courier">-c my_new_command_name</font></font><font size="4"><span style="font-size: 15px;"><see same results here></span></font><font size="4"><span style="font-size: 15px;"></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><br></span></font><font style="font-size: 16px;" size="4"><span style="font-size: 14px;">11 - define a service to use this new command you just setup:</span></font><font size="4"><span style="font-size: 15px;"><br>
</span></font><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"><br></span></font></font></span></font></div><div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">define service{</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"></span></font></font></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"><span style="white-space: pre;"> </span>use<span style="white-space: pre;"> </span>remote-service</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"></span></font></font></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"><span style="white-space: pre;"> </span>host_name<span style="white-space: pre;"> </span><client host name as defined in nagios host.cfg></span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"></span></font></font></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"><span style="white-space: pre;"> </span>service_description MySQL check for rowcount on table blah</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"></span></font></font></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"><span style="white-space: pre;"> </span>check_command check_nrpe!my_new_command_name</span></font></font><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;"></span></font></font></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font color="#000000"><font face="Courier" size="4"><span style="font-size: 14px;">}</span></font></font></span></font><font size="4"><span style="font-size: 15px;"></span></font></div>
<div><font size="4"><span style="font-size: 15px;"><font face="Courier" size="4"><span style="font-size: 14px;"><br></span></font></span></font><font size="4"><span style="font-size: 15px;">12 - restart nagios and away you go!</span></font><font size="4"><span style="font-size: 15px;"><br>
</span></font><font size="4"><span style="font-size: 15px;"><br></span></font></div><div><font size="4"><span style="font-size: 15px;">HTH</span></font><font size="4"><span style="font-size: 15px;"><br></span></font><font size="4"><span style="font-size: 15px;"><br>
</span></font></div><div><font size="4"><span style="font-size: 15px;">kyle</span></font></div><div><div><div></div><div class="Wj3C7c"><br>On Jun 14, 2008, at 1:16 AM, Kaushal Shriyan wrote:<br></div></div><blockquote type="cite">
<div><div></div><div class="Wj3C7c">Hi,<br><br>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<br>plugin<br><br>I have referred to <a href="http://nagiosplugins.org/man/check_mysql_query" target="_blank">http://nagiosplugins.org/man/check_mysql_query</a> for -w and -c option <br>
which says -w, --warning=RANGE Warning range (format: start:end). Alert if outside this range<br> -c, --critical=RANGE<br><br>How can i set this in nagios(nrpe.cfg) on the remote host.<br><br>Any example would be really helpful<br>
<br>I have set it like the below in the nrpe.cfg file<br><br>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<br>
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<br><br>Not sure if the above command is right.<br><br>Any ideas<br>
<br>Thanks and Regards<br><br>Kaushal<br><br><br></div></div><div style="margin: 0px;">-------------------------------------------------------------------------</div><div style="margin: 0px;">Check out the new SourceForge.net Marketplace.</div>
<div style="margin: 0px;">It's the best place to buy or sell services for</div><div style="margin: 0px;">just about anything Open Source.</div><div style="margin: 0px;"><a href="http://sourceforge.net/services/buy/index.php_______________________________________________" target="_blank">http://sourceforge.net/services/buy/index.php_______________________________________________</a></div>
<div style="margin: 0px;">Nagiosplug-help mailing list</div><div style="margin: 0px;"><a href="mailto:Nagiosplug-help@lists.sourceforge.net" target="_blank">Nagiosplug-help@lists.sourceforge.net</a></div><div style="margin: 0px;">
<a href="https://lists.sourceforge.net/lists/listinfo/nagiosplug-help" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagiosplug-help</a></div><div style="margin: 0px;">::: Please include plugins version (-v) and OS when reporting any issue.<span> </span></div>
<div style="margin: 0px;">::: Messages without supporting info will risk being sent to /dev/null</div> </blockquote></div><br></div></blockquote></div><br>