Problems when configuring and compiling ndoutils on CentOs 6

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
bkfrvn
Posts: 10
Joined: Thu Jan 16, 2014 2:20 pm

Re: Problems when configuring and compiling ndoutils on Cent

Post by bkfrvn »

I am trying compile ndoutils 1.5.2 on NagiosCore 3.5.0 with mysql 5.1.71
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Problems when configuring and compiling ndoutils on Cent

Post by slansing »

Okay so I went back and read over the thread again, and you cannot find a common.h header file? Are you pulling the NDOutils tarball from our sourceforge link?:

http://sourceforge.net/projects/nagios/ ... ils-1.5.2/

It is included, I recommend you remove your NDOutils tarball, and untarred director and try to download another fresh copy, and then follow the installation steps because you will definitely need that common.h and it is included with the tarball.
bkfrvn
Posts: 10
Joined: Thu Jan 16, 2014 2:20 pm

Re: Problems when configuring and compiling ndoutils on Cent

Post by bkfrvn »

I pulled the ndoutils-1.5.2 from the source you mentioned. I also deleted the old tarball, got the new one, compiled and got the same errors

Code: Select all

In file included from db.c:17:
../include/ndo2db.h:58: error: expected specifier-qualifier-list before ‘MYSQL’
db.c: In function ‘ndo2db_db_init’:
db.c:128: error: ‘ndo2db_dbconninfo’ has no member named ‘instance_id’
db.c:129: error: ‘ndo2db_dbconninfo’ has no member named ‘conninfo_id’
db.c:130: error: ‘ndo2db_dbconninfo’ has no member named ‘latest_program_status_time’
.....   

Here is the code made the errors in ndo2db.h

Code: Select all

typedef struct ndo2db_dbconninfo_struct{
   int server_type;
   int connected;
   int error;
#ifdef USE_MYSQL
   MYSQL mysql_conn;
   MYSQL_RES *mysql_result;
   MYSQL_ROW mysql_row;
#endif
#ifdef USE_PGSQL
   PGconn *pgsql_conn;
   PGresult *pgsql_result;
#endif
   unsigned long instance_id;
   unsigned long conninfo_id;
As I understand, MYSQL is a type thus it should be defined some where. However, the compiler does not find the definition of MYSQL. Please correct me if I am wrong.
I also can not find the definition of MYSQL in ndoutils source code.
I do not know why you mentioned the file common.h
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: Problems when configuring and compiling ndoutils on Cent

Post by millisa »

I had a few minutes to kill this evening.

I downloaded a copy of cactiez 0.7 and installed it into a virtual machine using their iso. Immediately after the install finished, I logged in as root and installed dev tools and grabbed a copy of the ndoutils. It compiled ok for me. I have left out none of the steps I took between clean install and running 'make'.

Code: Select all

[root@localhost tmp]# cat /etc/redhat-release 
CentOS release 6.3 (Final)
[root@localhost tmp]# uname -a
Linux localhost.localdomain 2.6.32-279.9.1.el6.x86_64 #1 SMP Tue Sep 25 21:43:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Installed dev tools and mysql-dev:

Code: Select all

yum install gcc make automake
This pulls in about a dozen dependency packages, updates glibc, libgcc, and libgcmp

Code: Select all

yum install mysql-devel
This pulls in about 9 packages along with updates for a dozen others (it updates mysql to 5.1.71-1 currently)

In case it helps, here are the mysql related rpms installed if you want to compare versions.

Code: Select all

[root@localhost ndoutils-1.5.2]# rpm -qa |grep mysql
mysql-libs-5.1.71-1.el6.x86_64
rsyslog-mysql-5.8.10-2.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
php-mysql-5.3.3-14.el6_3.x86_64
Grab the ndoutils src into tmp (it looked like that was where you were working):

Code: Select all

cd /tmp
wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz/download
Untar it

Code: Select all

tar fxpz ndoutils-1.5.2.tar.gz
Switch to the /tmp/nodutils-1.5.2 dir:

Code: Select all

cd ndoutils-1.5.2
Configure

Code: Select all

./configure
And make

Code: Select all

[root@localhost ndoutils-1.5.2]# make
cd ./src && make
make[1]: Entering directory `/tmp/ndoutils-1.5.2/src'
gcc -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -c -o io.o io.c
gcc -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -c -o utils.o utils.c
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -o file2sock file2sock.c io.o utils.o   -lm -lnsl 
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -o log2ndo log2ndo.c io.o utils.o   -lm -lnsl 
make ndo2db-2x
make[2]: Entering directory `/tmp/ndoutils-1.5.2/src'
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -c -o db.o db.c
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -D BUILD_NAGIOS_2X -c -o dbhandlers-2x.o dbhandlers.c
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H   -D BUILD_NAGIOS_2X -o ndo2db-2x queue.c ndo2db.c dbhandlers-2x.o io.o utils.o db.o    -lnsl -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto -lm 
make[2]: Leaving directory `/tmp/ndoutils-1.5.2/src'
make ndo2db-3x
make[2]: Entering directory `/tmp/ndoutils-1.5.2/src'
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -D BUILD_NAGIOS_3X -c -o dbhandlers-3x.o dbhandlers.c
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H   -D BUILD_NAGIOS_3X -o ndo2db-3x queue.c ndo2db.c dbhandlers-3x.o io.o utils.o db.o    -lnsl -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto -lm 
make[2]: Leaving directory `/tmp/ndoutils-1.5.2/src'
make ndomod-2x.o
make[2]: Entering directory `/tmp/ndoutils-1.5.2/src'
gcc -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -D BUILD_NAGIOS_2X -o ndomod-2x.o ndomod.c io.o utils.o -shared   -lnsl 
make[2]: Leaving directory `/tmp/ndoutils-1.5.2/src'
make ndomod-3x.o
make[2]: Entering directory `/tmp/ndoutils-1.5.2/src'
gcc -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -D BUILD_NAGIOS_3X -o ndomod-3x.o ndomod.c io.o utils.o -shared   -lnsl 
make[2]: Leaving directory `/tmp/ndoutils-1.5.2/src'
gcc -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H  -o sockdebug sockdebug.c io.o utils.o   -lm -lnsl 
make[1]: Leaving directory `/tmp/ndoutils-1.5.2/src'

So with those steps, the current ndoutils appears to compile on the exact OS install and version you are using. I'm hoping the steps above can be compared to what you were doing to figure out what step is being missed and causing the error you are seeing. If I had to guess, possibly your list of mysql related rpm's doesn't match the ones above.

Edit1: Fixed some grammar.
bkfrvn
Posts: 10
Joined: Thu Jan 16, 2014 2:20 pm

Re: Problems when configuring and compiling ndoutils on Cent

Post by bkfrvn »

I downloaded the new CactiEZ 0.7 image and compiled ndoutils right after the CactiEZ installation and the compilation was ok :).

The compilation on the old CactiEZ server, which is run for a long time, still had the same problem. Therefore, I will migrate the old server to the new one.

Thank you very much for help!
Locked