Further problems with NDO Utils

tom.welsh at bt.com tom.welsh at bt.com
Thu Sep 13 10:18:17 CEST 2007


Hi Andreas, Ton,

Thank you both very much for the help. I  now have a working ndo utils.

As I used 2 different versions off NDO Utils to get this working I will
document each 

NDO 1.4b5

My problem as you pointed out very well Andreas was my ld.so.conf. I had
not included the /usr/local/mysql/lib/mysql in it. I had included
/usr/local/mysql/lib.

Having run ldconfig I then started again. I used the following command
line for ./configure

./configure --enable-mysql --with-mysql-lib=/usr/local/mysql/lib/mysql
--with-mysql-inc=/usr/local/mysql/include

I then ran a make as suggested

make CPPFLAGS=-I/usr/local/mysql/include

This still gave me the same errors with config.h. I also tried various
CPPFLAGS but still get the same problems

I hacked the include/config.h file and specified the full path in front
off <mysql/mysql.h> and <mysql/errmsg.h>. The program then compiled fine

Having installed the files into the locations defined in the README file
I started up the broker and all is sweet.

Ton Voon's patched NDO 1.4b3
http://altinity.blogs.com/dotorg/2007/04/better_mysqlcli.html

http://resources.opsview.org/ndoutils-1.4b3_with_mysql_patch.tar.gz

Having fixed the ld.so.conf when I ran Ton's patched version which uses
the mysql_config I was provided with a fully functional binary. Steps as
follows

./configure --enable-mysql

Make

JOB DONE

Fantastic patch Ton. It worked flawlessly on my SUSE Linux Enterprise
Server 9.2

Perhaps as you suggest Ton, try and get this into the ndo main code. 

Once again thanks to you both for helping me through this.

Regards

Tom
-----Original Message-----
From: Andreas Ericsson [mailto:ae at op5.se] 
Sent: 13 September 2007 07:02
To: Welsh,T,Tom,XSL4A C
Cc: Nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Further problems with NDO Utils

tom.welsh at bt.com wrote:
> Hi Andreas,
> 
> Thanks for coming back to me on this.
> 
> Mysql was installed from source
> 
> 	mysql 5.0.45
> 	./configure --prefix=/usr/local/mysql
> 
> I believe that that is the default install location anyway.
> 

Yup.

> I ran ldd, I completely forgot about that and I get the following
> 
> 	  /usr/local/nagios/var # ldd /usr/local/nagios/bin/ndo2db
>         linux-gate.so.1 =>  (0xffffe000)
>         libz.so.1 => /lib/libz.so.1 (0x4001f000)
>         libnsl.so.1 => /lib/libnsl.so.1 (0x40030000)
>         libmysqlclient.so.15 => not found
> 
> As you can see its not found the libmysqlclient even though it says it

> has. If I run a find I can see it.
> 

Righto. This tells us two things:
* It's been successfully linked to libmsysqlclient.so.15 at
compile-time.
* It doesn't know where to find that lib.

There are multiple fixes to this problem.

You can do "cp /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib;
ldconfig"
(easiest, but it's got a dirty feel about it)

You can add /usr/local/mysql/lib/mysql to your /etc/ld.so.conf and
re-run ldconfig.
If you don't have an /etc/ld.so.conf your linker isn't new enough and
this option won't work.


> 	  # find / -name libmysqlclient.so.15
> 	  /usr/local/mysql/lib/mysql/libmysqlclient.so.15
> 
> I use the following command_line to configure ndo utils
> 
> 	  NDO-Utils 1.4b5
> 	  ./configure --enable-mysql
> --with-mysql-lib=/usr/local/mysql/lib/mysql
> --with-mysql-inc=/usr/local/mysql/include
> 
> When I run make I get the following error.
> 
> 	make
> 	cd ./src/; make ; cd ..
> 	make[1]: Entering directory `/home/w/ndoutils-1.4b5/src'
> 	gcc -fPIC -O0 -g -DHAVE_CONFIG_H -c -o io.o io.c
> 	In file included from io.c:10:
> 	../include/config.h:250:25: mysql/mysql.h: No such file or
directory
> 	../include/config.h:251:26: mysql/errmsg.h: No such file or
directory
> 	make[1]: *** [io.o] Error 1
> 	make[1]: Leaving directory `/home/welsht2/ndoutils-1.4b5/src'
> 

Try "make CPPFLAGS=-I/usr/local/mysql/include" instead of the config.h
hackery you described (for next time, that is). That will tell the
pre-processor to look for include-files in /usr/local/mysql/include as
well as the standard /usr/include.

> 
> 	make ndo2db-2x
> 	make[2]: Entering directory `/home/welsht2/ndoutils-1.4b5/src'
> 	gcc -O0 -g -DHAVE_CONFIG_H -c -o db.o db.c	
> 	gcc -O0 -g -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -c -o
dbhandlers-2x.o 
> dbhandlers.c
> 	gcc -O0 -g -DHAVE_CONFIG_H -I/usr/local/mysql/include -D
> BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c dbhandlers-2x.o io.o 	utils.o
> db.o  -L/usr/local/mysql/lib/mysql -lz  -lnsl -lmysqlclient -lm


Here is actually a problem. Since libmysqlclient.so.15 doesn't exist in
the normal ld.so.conf search-path, it should also have added
-Wl,r/usr/local/mysql/lib/mysql to the linker options, which would have
added /usr/local/mysql/lib/mysql to the search-path for this particular
binary only.


> 
> Any more ideas off how I can get this working. Im not very good with 
> hunting down software compilation problems :(
> 

See above ;-)

Inline posting helps a bit when explaining. May I suggest you try it out
in your answers? It makes helping out so much easier.

You should also try Ton Voon's suggestion, just to see if it fixes the
problem permanently. Please report back the results of that particular
exercise so we know if it's a real fix or not.

Thanks.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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