<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style>.EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; }</style>
</head>
<body>
<font face="Arial, sans-serif" size="2">
<div>I find that the check_mysql_query (nagios-plugins 1.4.9) 1.6 can not be used to call stored procedures</div>
<div> </div>
<div>When I try, I get an error</div>
<div> </div>
<div>viz.</div>
<div> </div>
<div>/usr/lib/nagios/plugins/check_mysql_query -q 'call sp_nagios_check()' -w 0:0 -c 1 --hostname=myhost --database=mydb --username=nagios --password=nagios</div>
<div>QUERY CRITICAL: Error with query - PROCEDURE limsdevbuild.sp_nagios_check can't return a result set in the given context</div>
<div> </div>
<div> </div>
<div>The fix is to fix the call to <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html">mysql_real_connect()</a> <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html"><font color="#0000FF"><u>http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html</u></font></a>,
which states </div>
<div> </div>
<div><font size="3">If your program uses the <font face="Courier New, monospace" size="2">CALL</font> SQL statement to execute stored procedures that produce result sets, you <i>must</i> set the <font face="Courier New, monospace" size="2">CLIENT_MULTI_RESULTS</font>
flag, either explicitly, or implicitly by setting <font face="Courier New, monospace" size="2">CLIENT_MULTI_STATEMENTS</font> when you call <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html"><font face="Courier New, monospace" size="2" color="#0000FF"><u>mysql_real_connect()</u></font></a>.
This is because each such stored procedure produces multiple results: the result sets returned by statements executed within the procedure, as well as a result to indicate the call status. </font></div>
<div><font size="3"> </font></div>
<div><font size="3">If you enable <font face="Courier New, monospace" size="2">CLIENT_MULTI_STATEMENTS</font> or <font face="Courier New, monospace" size="2">CLIENT_MULTI_RESULTS</font>, you should process the result for every call to <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-query.html"><font face="Courier New, monospace" size="2" color="#0000FF"><u>mysql_query()</u></font></a>
or <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-real-query.html"><font face="Courier New, monospace" size="2" color="#0000FF"><u>mysql_real_query()</u></font></a> by using a loop that calls <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-next-result.html"><font face="Courier New, monospace" size="2" color="#0000FF"><u>mysql_next_result()</u></font></a>
to determine whether there are more results. For an example, see <a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html"><font color="#0000FF"><u>Section 19.7.9, “C API Handling of Multiple Statement Execution”</u></font></a>. </font></div>
<div><font size="3"> </font></div>
<div>Any chance a patch can be issued?</div>
<div> </div>
<div>Also, can a new version of the plugin co-exist with an old version of nagios (Nagios 2.7)?</div>
<div> </div>
<div> </div>
<div>Thanks!</div>
<div> </div>
<div><font face="Arial, sans-serif">Malcolm Cook</font></div>
<div><font face="Arial, sans-serif">Database Applications Manager - Bioinformatics</font></div>
<div><font face="Arial, sans-serif">Stowers Institute for Medical Research - Kansas City, Missouri</font></div>
<div><font face="Arial, sans-serif"> </font></div>
<div><font face="Arial, sans-serif"> </font></div>
<div><font face="Arial, sans-serif"> </font></div>
<div><font face="Arial, sans-serif"> </font></div>
<div> </div>
</font>
</body>
</html>