NDOUtils Compilation MySQL

Hello,

As I lost hours mananging to compile NDOUtils 1.4b7on a Centos5 x86_64 with MYSQL, I thought I had to share the solution I found.
I stress that the problem had nothing to do with the fact that the OS was 64bits

When I compiled ndoutils with mysql support :

I got the following warning :

checking for mysql_store_result in -lmysqlclient... yes
checking for mysql_connect in -lmysqlclient... no

the compilation carries on but when I try to launch ndo2db : /usr/sbin/ndo2db-3x -c /etc/nagios/ndo2db.cfg

I get the following :

[root@localhost src]# /usr/sbin/ndo2db-3x -c /etc/nagios/ndo2db.cfg Support for the specified database server is either not yet supported, or was not found on your system.

Digging into it, I saw that in the configure file the test (that failed) was about checking the mysql_connect fonction offered by libmysqlclient_XX.so

BUT in the db.c file found in ndoutils, mysql_connect (which is deprecated in MySQL 5) is never used, mysql_real_connect (the MySQL5 connect method), on the other hand, is used.

So the solution is the following:

replace all mysql_connect string in the configure file (which can be done via vi with :%s/mysql_connect/mysql_real_connect/g)

Then everything compiles fine and ndoutils even launches !

If you still get the same error message trying to launch it it’s certainly because the :

line is missing in your /etc/nagios/ndo2db.cfg (or whatever the path of this file is).

Hope it will be helpfull to someone
Olivier