<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>You
could just look at the source of the existing mysql.</FONT></SPAN></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>I'd
probably modify check_mysql_query.c</FONT></SPAN></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>C and
perl are much alike so you will probably find it easier to start from something
that works than start from scratch.</FONT></SPAN></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>I
can't really see how an SNMP agent would work for this but then I've never tried
it!</FONT></SPAN></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>If you
want to use perl here is a very basic example.</FONT></SPAN></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=593592108-18042008>first you will need to install the per<SPAN
class=984023008-18042008>l</SPAN> modules </SPAN><SPAN
class=593592108-18042008>DBI and DBD-mysql</SPAN></FONT></FONT></FONT></DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>Then
this script can be modified to run query on your database.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2> use DBI;<BR> <BR> # Connect to the database.<BR>
my $dbh =
DBI->connect("DBI:mysql:database=squash;host=192.168.2.8",<BR>
"test",
"test",<BR>
{'RaiseError' => 1});</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>
# Now retrieve data from the table.<BR> my $sth = $dbh->prepare("SELECT
* FROM players");<BR> $sth->execute();<BR> while (my $ref =
$sth->fetchrow_hashref()) {<BR> print "Found a row: id =
$ref->{'id'}, name = $ref->{'name'}\n";<BR> }<BR>
$sth->finish();</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=593592108-18042008><FONT face=Arial color=#0000ff size=2>
# Disconnect from the database.<BR>
$dbh->disconnect();</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=593592108-18042008>Hope
that helps</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=593592108-18042008>Duncan</SPAN></FONT></DIV><FONT face=Arial
size=2></FONT></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
nagiosplug-help-bounces@lists.sourceforge.net
[mailto:nagiosplug-help-bounces@lists.sourceforge.net] <B>On Behalf Of
</B>Aniket Sawant<BR><B>Sent:</B> 18 April 2008 07:51<BR><B>To:</B>
jhmartin@toger.us; nagiosplug-help@lists.sourceforge.net<BR><B>Subject:</B>
Re: [Nagiosplug-help] Please help me..... Nagios supports thisfunctionality
??<BR><BR></FONT></DIV><BR><BR>
<DIV class=gmail_quote>On Thu, Apr 17, 2008 at 9:03 PM, Jason Martin <<A
href="mailto:jhmartin@toger.us">jhmartin@toger.us</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV class=Ih2E3d>On Thu, Apr 17, 2008 at 08:45:22PM +0530, Aniket Sawant
wrote:<BR>> Is there any way to send a notification on specific column
value in mysql.<BR>> or there is any plug-in which can support custom
query.<BR>> Does nagios support this type of functionality?...<BR></DIV>I
don't think there are any stock plugins that do this exactly.<BR>However,
all you have to do is write a script that will exit<BR>with return code 0 if
your conditions are not met, and 2 if they<BR>are. Then have Nagios
execute it and it will alert if there is<BR>a problem.<BR><BR>-Jason
Martin<BR><FONT color=#888888>--<BR>This message is PGP/MIME
signed.<BR></FONT></BLOCKQUOTE></DIV><BR>Hi Jason,<BR><BR>I'm very very
thankful to you for replying. I understand what you want to say. You mean to
say that i have to write a perl script that will check for the conditions by
writting a custom SQL query and return 0, 1, 2, 3 as status code, And nagios
will send a alert/notification depending on that return status.<BR>Do you know
where should i get such a perl script on web. I dont know anything about
Perl.<BR>i have also figure out that will my problem resolved by creating
client SNMP agent which will communicate with mysql and send the response
back. and using that response, nagios will send a notification.<BR>Or there is
any alternate way to do this.<BR><BR>Thanks,<BR>Aniket.<BR><BR>-- <BR>This
message has been scanned for viruses and <BR>dangerous content by <A
href="http://www.mailscanner.info/"><B>MailScanner</B></A>, and is
<BR>believed to be clean. </BLOCKQUOTE></BODY><br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</HTML>