Nagios 'could not connect' to MySQL database

Dan Hopkins dan.hopkins at uk.easynet.net
Tue Aug 16 16:23:22 CEST 2005


(Apologies for the blank reply...)

Sounds like you're using a mysql4.1 db with mysql <4.1 client libs. If that's the case, either upgrade the client end to 4.1, or set password = old_password('blah') on the server.

HTH

Dan

> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of
> Richard.Luys at vanderlet.nl
> Sent: 16 August 2005 15:18
> To: nagios-users at lists.sourceforge.net
> Cc: werner.flamme at ufz.de
> Subject: RE: [Nagios-users] Nagios 'could not connect' to 
> MySQL database
> 
> 
>  
> Hello Again Werner!
> 
> > -----Original Message-----
> > From: nagios-users-admin at lists.sourceforge.net 
> > [mailto:nagios-users-admin at lists.sourceforge.net] On Behalf 
> > Of Werner Flamme
> > Sent: Tuesday, August 16, 2005 4:03 PM
> > To: nagios-users at lists.sourceforge.net
> > Subject: Re: [Nagios-users] Nagios 'could not connect' to 
> > MySQL database
> > 
> > Richard.Luys at vanderlet.nl schrieb am 16.08.2005 14:24:
> > > Werner,
> > >  
> > > 
> > > 
> > >>---snip---
> > >>
> > >>>When I check the nagios.log I get the following errors:
> > >>>[1123752497] Finished daemonizing... (New PID=26747) [1123752497]
> > >>>Error: Could not connect to MySQL database 'nagios' on host 
> > >>>'localhost' using username 'nagios' and password 
> > 'removed'.  Status 
> > >>>data will not be saved!
> > 
> > Hmmm... when I look at my self-compiled nagios 1.2 on SLES 8, 
> > I see that there are 2 files you have to maintain for mysql. 
> > Did you look at cgi.cfg?
> 
> My bad. I typed nagios.cfg when I meant cgi.cfg. The other is the
> resource.cfg. It's strange indeed that you have to put a lot of this
> identical information in two different config-files. But 
> these files are
> both correctly configured.
> 
> > 
> > If yes - I don't know what may be the cause then. I remember 
> > I made the entries in one of those and forgot the other. And 
> > I had quite similar errors...
> 
> I think I do. Here's what I found:
> 
> Googling on the internet reminded me of the 
> 'check_nagios_db.pl' script;
> which is used for checking if Nagios is running when you use 
> a database
> for the logging etc. I ran the script, and got the same error. So I
> focussed a bit on the Perl::DBI driver, and came across a very basic
> script to test if it works correctly. I ran that script, and 
> received an
> error like 'Client does not support authentication protocol 
> requested by
> server...'. That was more descriptive than 'could not 
> connect...'! So I
> took the part that is responsible for showing this error( 
> $DBI::errstr),
> and put it in the error-comment of the check_nagios_db.pl script. And
> voila! I got the same message there!
> 
> In other words, it looks like there is an incompatibility issue in how
> Perl::DBI and Nagios try to authenticate with the database. I checked
> the MySQL-site and found this very same error in the 
> documentation pages
> ( http://dev.mysql.com/doc/mysql/en/old-client.html ). I will look
> further into it, and post my findings; maybe it helps 
> somebody with the
> same problem.
> 
> I learned a very important lesson here: When you write a 
> script, develop
> a program, or whatever, make sure you give sufficient 
> feedback! When the
> errors in the logging stated why they 'could not connect' instead of
> just that message, the problem was probably fixed a week ago! I had to
> stumble across a perl-statement for showing the real error, 
> to find out
> what is really the problem...
> 
> > 
> > HTH now ;-)
> > Werner
> > 
> > --
> > Werner Flamme, Abt. WKDV
> > UFZ Umweltforschungszentrum Leipzig-Halle GmbH, Permoserstr. 
> > 15, 04318 Leipzig - http://www.ufz.de
> > eMail: werner.flamme at ufz.de, Tel.: (0341) 235-2500
> > 
> > 
> > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development 
> > Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * 
> > Testing & QA
> > Security * Process Improvement & Measurement * 
> > http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Nagios-users mailing list
> > Nagios-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-users
> > ::: Please include Nagios version, plugin version (-v) and OS 
> > when reporting any issue. 
> > ::: Messages without supporting info will risk being sent 
> to /dev/null
> > 
> 
> This e-mail message and its attachments are subject to the 
> disclaimer published at the following website of VANDERLET: 
> http://www.vanderlet.nl/disclaimer 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development 
> Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * 
> Testing & QA
> Security * Process Improvement & Measurement * 
http://www.sqe.com/bsce5sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list