[Nagiosplug-help] Please help me..... Nagios supports thisfunctionality ??

Duncan Berriman duncan at dcl.co.uk
Fri Apr 18 10:31:44 CEST 2008


You could just look at the source of the existing mysql.
 
I'd probably modify check_mysql_query.c
 
C and perl are much alike so you will probably find it easier to start from
something that works than start from scratch.
 
I can't really see how an SNMP agent would work for this but then I've never
tried it!
 
If you want to use perl here is a very basic example.
 
first you will need to install the perl modules DBI and DBD-mysql
 
Then this script can be modified to run query on your database.
 
 use DBI;
 
  # Connect to the database.
  my $dbh = DBI->connect("DBI:mysql:database=squash;host=192.168.2.8",
                         "test", "test",
                         {'RaiseError' => 1});
 
 
 
  # Now retrieve data from the table.
  my $sth = $dbh->prepare("SELECT * FROM players");
  $sth->execute();
  while (my $ref = $sth->fetchrow_hashref()) {
    print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";
  }
  $sth->finish();
 
  # Disconnect from the database.
  $dbh->disconnect();
 
Hope that helps
Duncan

-----Original Message-----
From: nagiosplug-help-bounces at lists.sourceforge.net
[mailto:nagiosplug-help-bounces at lists.sourceforge.net] On Behalf Of Aniket
Sawant
Sent: 18 April 2008 07:51
To: jhmartin at toger.us; nagiosplug-help at lists.sourceforge.net
Subject: Re: [Nagiosplug-help] Please help me..... Nagios supports
thisfunctionality ??




On Thu, Apr 17, 2008 at 9:03 PM, Jason Martin <jhmartin at toger.us> wrote:


On Thu, Apr 17, 2008 at 08:45:22PM +0530, Aniket Sawant wrote:
> Is there any way to send a notification on specific column value in mysql.
> or there is any plug-in which can support custom query.
> Does nagios support this type of functionality?...

I don't think there are any stock plugins that do this exactly.
However, all you have to do is write a script that will exit
with return code 0 if your conditions are not met, and 2 if they
are.  Then have Nagios execute it and it will alert if there is
a problem.

-Jason Martin
--
This message is PGP/MIME signed.



Hi Jason,

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.
Do you know where should i get such a perl script on web. I dont know
anything about Perl.
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.
Or there is any alternate way to do this.

Thanks,
Aniket.

-- 
This message has been scanned for viruses and 
dangerous content by  <http://www.mailscanner.info/> MailScanner, and is 
believed to be clean. 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20080418/7ea5a14c/attachment.html>


More information about the Help mailing list