<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1255">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:right;
direction:rtl;
unicode-bidi:embed;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'>Hey
there,<o:p></o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'><o:p> </o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'>This
is a small plugin, based on the original check_mysql_query.c<o:p></o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'>I
wanted to know what you think about it and maybe you have other ideas how to
implement this.<o:p></o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'><o:p> </o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'>The
idea is to monitor slow queries on remote systems that may be bringing a mysql
process to its knees,<o:p></o:p></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'>Which
as of current does not raise an exception on the nagios system<o:p></o:p></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>const
char *progname = "check_mysql_query";<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>const
char *revision = "$Revision: 2034 $";<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>const
char *copyright = "1999-2007";<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>const
char *email = "nagiosplug-devel@lists.sourceforge.net";<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
"common.h"<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
"utils.h"<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
"utils_base.h"<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
"netutils.h"<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
<mysql.h><o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#include
<errmsg.h><o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*db_user = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*db_host = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*db_socket = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*db_pass = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*db = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*warning = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*critical = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>unsigned
int db_port = MYSQL_PORT;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int
process_arguments (int, char **);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int
validate_arguments (void);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>void
print_help (void);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>void
print_usage (void);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>char
*sql_query = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int
verbose = 0;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>thresholds
*my_thresholds = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int
main (int argc, char **argv)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> MYSQL
mysql;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> MYSQL_RES
*res;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> MYSQL_ROW
row;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> char
*error = NULL;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> int
time;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> int
warning_int,critical_int;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> setlocale
(LC_ALL, "");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> bindtextdomain
(PACKAGE, LOCALEDIR);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> textdomain
(PACKAGE);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
Parse extra opts if any */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> argv=np_extra_opts
(&argc, argv, progname);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(process_arguments (argc, argv) == ERROR)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> usage4
(_("Could not parse arguments"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
warning_int = atoi(warning);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
critical_int = atoi(critical);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
initialize mysql */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_init
(&mysql);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"client");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
establish a connection to the server and error checking */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(!mysql_real_connect(&mysql,db_host,db_user,db_pass,"",db_port,db_socket,0))
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(mysql_errno (&mysql) == CR_UNKNOWN_HOST)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error
(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else
if (mysql_errno (&mysql) == CR_VERSION_ERROR)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error
(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else
if (mysql_errno (&mysql) == CR_OUT_OF_MEMORY)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error
(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else
if (mysql_errno (&mysql) == CR_IPSOCK_ERROR)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error
(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else
if (mysql_errno (&mysql) == CR_SOCKET_CREATE_ERROR)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error
(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_CRITICAL, "QUERY %s: %s\n", _("CRITICAL"),
mysql_error (&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(mysql_query (&mysql, "show processlist;") != 0) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> error
= strdup(mysql_error(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_close
(&mysql);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_CRITICAL, "QUERY %s: %s - %s\n", _("CRITICAL"),
_("Error with query"), error);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
store the result */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
( (res = mysql_store_result (&mysql)) == NULL) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> error
= strdup(mysql_error(&mysql));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_close
(&mysql);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_CRITICAL, "QUERY %s: Error with store_result - %s\n",
_("CRITICAL"), error);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
Check there is some data */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(mysql_num_rows(res) == 0) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_close(&mysql);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> die
(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), _("No
rows returned"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
fetch the first row */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> while
( (row = mysql_fetch_row (res)) != NULL) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if(strcmp(row[4],"Query")
== 0)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
time = (int) atoi(row[5]);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
if (time>=warning_int && time<critical_int)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
die (STATE_WARNING, "%s QUERY time %d\n",
_("WARNING"),time);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
else if (time>=critical_int)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
die (STATE_CRITICAL, "%s QUERY time %d\n",
_("CRITICAL"),time);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>/**
else if (strcmp(row[4],"Sleep") == 0)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
time = (int)atoi(row[5]);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
printf("MYSQL PERFORMANCE SEEMS OK\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
exit (STATE_OK);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>**/<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
printf("MYSQL PERFORMANCE SEEMS OK \n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_free_result
(res);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> mysql_close
(&mysql);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
exit (STATE_OK);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> return
1;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>/*
process command-line arguments */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>process_arguments
(int argc, char **argv)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> int
c;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> int
option = 0;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> static
struct option longopts[] = {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"hostname",
required_argument, 0, 'H'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"socket",
required_argument, 0, 's'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"database",
required_argument, 0, 'd'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"username",
required_argument, 0, 'u'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"password",
required_argument, 0, 'p'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"port",
required_argument, 0, 'P'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"verbose",
no_argument, 0, 'v'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"version",
no_argument, 0, 'V'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"help",
no_argument, 0, 'h'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"warning",
required_argument, 0, 'w'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {"critical",
required_argument, 0, 'c'},<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> {0,
0, 0, 0}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> };<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(argc < 1)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> return
ERROR;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> while
(1) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> c
= getopt_long (argc, argv, "hvVSP:p:u:d:H:s:q:w:c:", longopts,
&option);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(c == -1 || c == EOF)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> switch
(c) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'H': /* hostname */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(is_host (optarg)) {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_host
= optarg;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> else
{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> usage2
(_("Invalid hostname/address"), optarg);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
's': /* socket */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_socket
= optarg;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'u': /* username */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_user
= optarg;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'p': /*
authentication information: password */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_pass
= strdup(optarg);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> /*
Delete the password from process list */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> while
(*optarg != '\0') {<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> *optarg
= 'X';<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> optarg++;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'P': /* critical
time threshold */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_port
= atoi (optarg);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'v':<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> verbose++;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'V': /* version */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> print_revision
(progname, revision);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> exit
(STATE_OK);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'h': /* help */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> print_help
();<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> exit
(STATE_OK);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'w':<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> warning
= optarg;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'c':<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> critical
= optarg;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> break;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> case
'?': /* help */<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> usage5
();<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> c
= optind;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> set_thresholds(&my_thresholds,
warning, critical);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> return
validate_arguments ();<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>int<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>validate_arguments
(void)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(db_user == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_user
= strdup("");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(db_host == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_host
= strdup("");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(db_pass == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db_pass
= strdup("");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(db == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> db
= strdup("");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(warning == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> warning
= strdup("3");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> if
(critical == NULL)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> critical
= strdup("10");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> return
OK;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>void<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>print_help
(void)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> char
*myport;<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> asprintf
(&myport, "%d", MYSQL_PORT);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> print_revision
(progname, revision);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(COPYRIGHT), copyright, email);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
("%s\n", _("This program checks a query result against threshold
levels"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
("\n\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> print_usage
();<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_HELP_VRSN));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_EXTRA_OPTS));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("SQL query to run. Only first column in first row
will be read"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_WARN_CRIT_RANGE));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_HOST_PORT), 'P', myport);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", "-s, --socket=STRING");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("Use the specified socket (has no effect if -H is
used)"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" -u, --username=STRING\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("Username to login with"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" -p, --password=STRING\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("Password to login with"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION
IS NOT SECURE!!!"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("Your clear-text password could be visible as a
process table entry"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
("\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("A query is required. The result from the query
should be numeric."));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(" %s\n", _("For extra security, create a user with minimal
access."));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#ifdef
NP_EXTRA_OPTS<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
("\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
("%s\n", _("Notes:"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_EXTRA_OPTS_NOTES));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>#endif<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'> printf
(_(UT_SUPPORT));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>void<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>print_usage
(void)<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
printf (_("Usage:"));<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
printf (" %s -q SQL_slow [-w warn] [-c crit] [-H host] [-P port] [-s
socket]\n",progname);<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>
printf (" [-d database] [-u user] [-p password]\n");<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:left;text-autospace:none;direction:ltr;
unicode-bidi:embed'><span style='font-size:9.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal dir=RTL><span dir=LTR><o:p> </o:p></span></p>
<p class=MsoNormal dir=RTL><span dir=LTR><o:p> </o:p></span></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'>àìé
ùîø</span><span dir=LTR><o:p></o:p></span></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'>îðäì
úùúéåú </span><span dir=LTR>WEB</span><span
lang=HE style='font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'>÷åðñéñè
îòøëåú<o:p></o:p></span></p>
<p class=MsoNormal dir=RTL><span lang=HE style='font-family:"Arial","sans-serif"'>0523-353534<o:p></o:p></span></p>
<p class=MsoNormal dir=RTL><span dir=LTR><o:p> </o:p></span></p>
<p class=MsoNormal style='text-align:left;direction:ltr;unicode-bidi:embed'><o:p> </o:p></p>
</div>
</body>
</html>