<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
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 class="Apple-style-span" color="#000000"><font class="Apple-style-span" 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><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 class="Apple-style-span" color="#000000"><font class="Apple-style-span" 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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 16px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font style="font: normal normal normal 15px/normal Helvetica; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; ">5 - verify check_nrpe plugin and <span class="Apple-style-span" style="font-size: 14px; ">NRPE</span> daemon talking ok</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; ">% /usr/nagios/libexec/check_nrpe -H localhost</span></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 15px; "><font class="Apple-style-span" size="4" style="font-size: 16px; "><span class="Apple-style-span" style="font-size: 14px; ">NRPE v2.11</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; ">% /usr/local/nagios/</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; ">libexec/</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-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 class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">define command {</font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span>command_name    check_nrpe</font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span>command_line    /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$</font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">}</font></font><br><br></div><div>9 - verify communication with the NRPE daemon on your remote client<br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"><br></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" 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 class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"><br></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">/usr/local/nagios/</font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">libexec/</font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">check_nrpe -H  </font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier"><remote_client_IP_address> </font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier">-c my_new_command_name</font></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><see same results here></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font><font class="Apple-style-span" size="4" style="font-size: 16px; "><span class="Apple-style-span" style="font-size: 14px; ">11 - define a service to use this new command you just setup:</span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "><br></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; ">define service{</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span>use<span class="Apple-tab-span" style="white-space:pre">         </span>remote-service</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "><span class="Apple-tab-span" style="white-space:pre">    </span>host_name<span class="Apple-tab-span" style="white-space:pre">   </span><client host name as defined in nagios host.cfg></span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "><span class="Apple-tab-span" style="white-space:pre">    </span>service_description     MySQL check for rowcount on table blah</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "><span class="Apple-tab-span" style="white-space:pre">    </span>check_command           check_nrpe!my_new_command_name</span></font></font><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; "></span></font></font></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px; ">}</span></font></font></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><font class="Apple-style-span" face="Courier" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; ">12 - restart nagios and away you go!</span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; ">HTH</span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; "><br></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 15px; ">kyle</span></font></div><div><html><br></html><html>On Jun 14, 2008, at 1:16 AM, Kaushal Shriyan wrote:</html><br class="Apple-interchange-newline"><blockquote type="cite">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">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 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-------------------------------------------------------------------------</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Check out the new SourceForge.net Marketplace.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">It's the best place to buy or sell services for</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">just about anything Open Source.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://sourceforge.net/services/buy/index.php_______________________________________________">http://sourceforge.net/services/buy/index.php_______________________________________________</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Nagiosplug-help mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:Nagiosplug-help@lists.sourceforge.net">Nagiosplug-help@lists.sourceforge.net</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="https://lists.sourceforge.net/lists/listinfo/nagiosplug-help">https://lists.sourceforge.net/lists/listinfo/nagiosplug-help</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">::: Please include plugins version (-v) and OS when reporting any issue.<span class="Apple-converted-space"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">::: Messages without supporting info will risk being sent to /dev/null</div> </blockquote></div><br></body></html>