Nagios with mysql


#1

hi,
i’m trying to install nagios with mysql support but when i run make all i get following messages:

…/xdata/xrddb.c:42:26: mysql/errmsg.h: No such file or directory
…/xdata/xcddb.c:49:25: mysql/mysql.h: No such file or directory
…/xdata/xcddb.c:50:26: mysql/errmsg.h: No such file or directory
…/xdata/xcddb.c:66: error: parse error before “xcddb_mysql”
…/xdata/xcddb.c:66: warning: data definition has no type or storage class
…/xdata/xcddb.c: In function xcddb_validate_host_comments': ../xdata/xcddb.c:449: error:MYSQL_RES’ undeclared (first use in this function)
…/xdata/xcddb.c:449: error: (Each undeclared identifier is reported only once
…/xdata/xcddb.c:449: error: for each function it appears in.)
…/xdata/xcddb.c:449: error: query_result' undeclared (first use in this function) ../xdata/xcddb.c:450: error:MYSQL_ROW’ undeclared (first use in this function)

etc.


#2

mysql-devel is installed right?
Show us the command and output that shows that.


#3

[quote=“jakkedup”]mysql-devel is installed right?
Show us the command and output that shows that.[/quote]

yes mysql-devel is installed.

./configure --with-mysql-xdata --with-mysql-status --with-mysql-comments --with-mysql-extinfo --with-mysql-retention --with-mysql-lib=/usr/local/mysql/lib --with-mysql-inc=/usr/local/mysql/include

and i get following output (for make all):

gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o checks.o checks.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o config.o config.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o commands.o commands.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o flapping.o flapping.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o logging.o logging.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o notifications.o notifications.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o sehandlers.o sehandlers.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o utils.o utils.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o sretention.o sretention.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -c -o perfdata.o perfdata.c
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE -L/usr/local/mysql/lib -lmysqlclient nagios.c checks.o config.o commands.o flapping.o logging.o notifications.o sehandlers.o utils.o sretention.o …/xdata/xrddb.c …/common/comments.c …/xdata/xcddb.c …/common/objects.c …/xdata/xodtemplate.c …/common/statusdata.c …/xdata/xsddb.c perfdata.o …/xdata/xpddefault.c …/common/downtime.c …/xdata/xdddb.c -lm -o nagios
/tmp/cctHom0Y.o(.text+0xf3): In function xrddb_query': ../xdata/xrddb.c:329: undefined reference tomysql_query’
/tmp/cctHom0Y.o(.text+0x158): In function xrddb_read_service_information': ../xdata/xrddb.c:1129: undefined reference tomysql_store_result’
/tmp/cctHom0Y.o(.text+0x3b2):…/xdata/xrddb.c:1191: undefined reference to mysql_fetch_row' /tmp/cctHom0Y.o(.text+0x3f8):../xdata/xrddb.c:1195: undefined reference tomysql_free_result’
/tmp/cctHom0Y.o(.text+0x488): In function xrddb_read_host_information': ../xdata/xrddb.c:951: undefined reference tomysql_store_result’
/tmp/cctHom0Y.o(.text+0x67a):…/xdata/xrddb.c:999: undefined reference to mysql_fetch_row' /tmp/cctHom0Y.o(.text+0x696):../xdata/xrddb.c:1004: undefined reference tomysql_free_result’
/tmp/cctHom0Y.o(.text+0x728): In function xrddb_read_program_information': ../xdata/xrddb.c:850: undefined reference tomysql_store_result’
/tmp/cctHom0Y.o(.text+0x753):…/xdata/xrddb.c:854: undefined reference to mysql_fetch_row' /tmp/cctHom0Y.o(.text+0x822):../xdata/xrddb.c:867: undefined reference tomysql_free_result’
/tmp/cctHom0Y.o(.text+0x10ac): In function xrddb_disconnect': ../xdata/xrddb.c:299: undefined reference tomysql_close’
/tmp/cctHom0Y.o(.text+0x10ef): In function `xrddb_connect’:

[etc]
[last few lines]

…/xdata/xdddb.c:887: undefined reference to mysql_insert_id' /tmp/cc9J0H9w.o(.text+0xb87): In functionxdddb_save_host_downtime’:
…/xdata/xdddb.c:788: undefined reference to mysql_insert_id' /tmp/cc9J0H9w.o(.text+0xc10): In functionxdddb_initialize’:
…/xdata/xdddb.c:234: undefined reference to mysql_init' collect2: ld returned 1 exit status make[1]: *** [nagios] Error 1 make[1]: Leaving directory/usr/local/apache2/nagios/base’
make: *** [all] Error 2


#4

[quote=“jakkedup”]mysql-devel is installed right?
Show us the command and output that shows that.[/quote]

hmm…or you asked for ./configure output?


#5

if you install 1.3 be sure you want to keep it.
V2 does not suport MySQL anymore. so it could be worth usingnagios without it if you plan to migrate in a short-medium term (like when it’s out of beta)

Luca


#6

[quote=“luca”]if you install 1.3 be sure you want to keep it.
V2 does not suport MySQL anymore. so it could be worth usingnagios without it if you plan to migrate in a short-medium term (like when it’s out of beta)
Luca[/quote]

well, i need nagios with mysql support (i suppose i could use 1.2 or 1.3)


#7

may i ask what you need the mysql support for ?

Luca


#8

[quote=“luca”]may i ask what you need the mysql support for ?

Luca[/quote]

i develop some application and i need status of network hosts so i thought i could import host status from nagios through mysql…


#9

ok, sorry, i had a momentary suspect you wanted mysql support to monitor mysql hosts… :slight_smile:

As for your problem i don’t remember how i did my first install of Nagios… (switched to 2b since) anyway checking debian packages i found two distinct mysql-dev and mysql-devel listed… could it be this?

Luca


#10

Hi.

I’m experiencing the same errors.
My system is running Fedora Core 4.
MySQL-standard-5.0.18 is installed from source and MySQL-devel-5.0.18 is installed from an RPM, both downloaded from the MySQL website.
I ran the Nagios configure script with the following parameters: --with-mysql-xdata --enable-embedded-perl --with-mysql-lib=/usr/local/mysql/lib --with-mysql-inc=/usr/local/include/mysql
When running “make all” I get the following result:


gcc -g -O2 -I/usr/local/include/mysql -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE -DHAVE_CONFIG_H -DNSCORE -L/usr/local/mysql/lib -lmysqlclient nagios.c checks.o config.o commands.o flapping.o logging.o notifications.o sehandlers.o utils.o sretention.o …/xdata/xrddb.c …/common/comments.c …/xdata/xcddb.c …/common/objects.c …/xdata/xodtemplate.c …/common/statusdata.c …/xdata/xsddb.c perfdata.o …/xdata/xpddefault.c …/common/downtime.c …/xdata/xdddb.c -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE -L/usr/local/lib /usr/lib/perl5/5.8.6/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -lm -o nagios
/tmp/ccmx4y2C.o(.text+0x10): In function xrddb_initialize': ../xdata/xrddb.c:215: undefined reference tomysql_init’
/tmp/ccmx4y2C.o(.text+0x92): In function xrddb_connect': ../xdata/xrddb.c:252: undefined reference tomysql_real_connect’
/tmp/ccmx4y2C.o(.text+0xad):…/xdata/xrddb.c:254: undefined reference to mysql_close' /tmp/ccmx4y2C.o(.text+0x108): In functionxrddb_disconnect’:
…/xdata/xrddb.c:299: undefined reference to mysql_close' /tmp/ccmx4y2C.o(.text+0x11f): In functionxrddb_query’:
…/xdata/xrddb.c:329: undefined reference to mysql_query' /tmp/ccmx4y2C.o(.text+0xc07): In functionxrddb_read_program_information’:
…/xdata/xrddb.c:850: undefined reference to mysql_store_result' /tmp/ccmx4y2C.o(.text+0xc65):../xdata/xrddb.c:854: undefined reference tomysql_fetch_row’
/tmp/ccmx4y2C.o(.text+0xd17):…/xdata/xrddb.c:867: undefined reference to mysql_free_result' /tmp/ccmx4y2C.o(.text+0xd9b): In functionxrddb_read_host_information’:
…/xdata/xrddb.c:951: undefined reference to mysql_store_result' /tmp/ccmx4y2C.o(.text+0xf4f):../xdata/xrddb.c:955: undefined reference tomysql_fetch_row’
/tmp/ccmx4y2C.o(.text+0xf6a):…/xdata/xrddb.c:1004: undefined reference to mysql_free_result' /tmp/ccmx4y2C.o(.text+0x100b): In functionxrddb_read_service_information’:
…/xdata/xrddb.c:1129: undefined reference to mysql_store_result' /tmp/ccmx4y2C.o(.text+0x1220):../xdata/xrddb.c:1133: undefined reference tomysql_fetch_row’
/tmp/ccmx4y2C.o(.text+0x1260):…/xdata/xrddb.c:1195: undefined reference to mysql_free_result' /tmp/ccKBrpi8.o(.text+0x10): In functionxcddb_initialize’:
…/xdata/xcddb.c:234: undefined reference to mysql_init' /tmp/ccKBrpi8.o(.text+0x86): In functionxcddb_connect’:
…/xdata/xcddb.c:259: undefined reference to mysql_real_connect' /tmp/ccKBrpi8.o(.text+0xa1):../xdata/xcddb.c:261: undefined reference tomysql_close’
/tmp/ccKBrpi8.o(.text+0xfc): In function xcddb_disconnect': ../xdata/xcddb.c:303: undefined reference tomysql_close’
/tmp/ccKBrpi8.o(.text+0x113): In function xcddb_query': ../xdata/xcddb.c:329: undefined reference tomysql_query’
/tmp/ccKBrpi8.o(.text+0x2e7): In function xcddb_validate_service_comments': ../xdata/xcddb.c:566: undefined reference tomysql_store_result’
/tmp/ccKBrpi8.o(.text+0x312):…/xdata/xcddb.c:570: undefined reference to mysql_fetch_row' /tmp/ccKBrpi8.o(.text+0x500): In functionxcddb_save_host_comment’:
…/xdata/xcddb.c:748: undefined reference to mysql_insert_id' /tmp/ccKBrpi8.o(.text+0x6bb): In functionxcddb_save_service_comment’:
…/xdata/xcddb.c:847: undefined reference to mysql_insert_id' /tmp/ccKBrpi8.o(.text+0xc3f): In functionxcddb_validate_host_comments’:
…/xdata/xcddb.c:477: undefined reference to mysql_store_result' /tmp/ccKBrpi8.o(.text+0xc69):../xdata/xcddb.c:481: undefined reference tomysql_fetch_row’
/tmp/ccIXEjmC.o(.text+0x10): In function xsddb_initialize': ../xdata/xsddb.c:253: undefined reference tomysql_init’
/tmp/ccIXEjmC.o(.text+0x92): In function xsddb_connect': ../xdata/xsddb.c:286: undefined reference tomysql_real_connect’
/tmp/ccIXEjmC.o(.text+0xad):…/xdata/xsddb.c:288: undefined reference to mysql_close' /tmp/ccIXEjmC.o(.text+0x120): In functionxsddb_disconnect’:
…/xdata/xsddb.c:335: undefined reference to mysql_close' /tmp/ccIXEjmC.o(.text+0x138): In functionxsddb_check_connection’:
…/xdata/xsddb.c:363: undefined reference to mysql_errno' /tmp/ccIXEjmC.o(.text+0x15d):../xdata/xsddb.c:369: undefined reference tomysql_close’
/tmp/ccIXEjmC.o(.text+0x2a7): In function xsddb_query': ../xdata/xsddb.c:463: undefined reference tomysql_query’
/tmp/cc1bZe5x.o(.text+0x10): In function xdddb_initialize': ../xdata/xdddb.c:234: undefined reference tomysql_init’
/tmp/cc1bZe5x.o(.text+0x86): In function xdddb_connect': ../xdata/xdddb.c:259: undefined reference tomysql_real_connect’
/tmp/cc1bZe5x.o(.text+0xa1):…/xdata/xdddb.c:261: undefined reference to mysql_close' /tmp/cc1bZe5x.o(.text+0xfc): In functionxdddb_disconnect’:
…/xdata/xdddb.c:303: undefined reference to mysql_close' /tmp/cc1bZe5x.o(.text+0x113): In functionxdddb_query’:
…/xdata/xdddb.c:329: undefined reference to mysql_query' /tmp/cc1bZe5x.o(.text+0x461): In functionxdddb_save_host_downtime’:
…/xdata/xdddb.c:788: undefined reference to mysql_insert_id' /tmp/cc1bZe5x.o(.text+0x627): In functionxdddb_save_service_downtime’:
…/xdata/xdddb.c:887: undefined reference to mysql_insert_id' /tmp/cc1bZe5x.o(.text+0xa79): In functionxdddb_validate_host_downtime’:
…/xdata/xdddb.c:473: undefined reference to mysql_store_result' /tmp/cc1bZe5x.o(.text+0xa8d):../xdata/xdddb.c:477: undefined reference tomysql_fetch_row’
/tmp/cc1bZe5x.o(.text+0xb45): In function xdddb_validate_service_downtime': ../xdata/xdddb.c:587: undefined reference tomysql_store_result’
/tmp/cc1bZe5x.o(.text+0xb59):…/xdata/xdddb.c:591: undefined reference to mysql_fetch_row' /tmp/cc1bZe5x.o(.text+0xc29): In functionxdddb_read_host_downtime’:
…/xdata/xdddb.c:1107: undefined reference to mysql_store_result' /tmp/cc1bZe5x.o(.text+0xc44):../xdata/xdddb.c:1111: undefined reference tomysql_fetch_row’
/tmp/cc1bZe5x.o(.text+0xd25):…/xdata/xdddb.c:1116: undefined reference to mysql_free_result' /tmp/cc1bZe5x.o(.text+0xd40):../xdata/xdddb.c:1149: undefined reference tomysql_free_result’
/tmp/cc1bZe5x.o(.text+0xda1): In function xdddb_read_service_downtime': ../xdata/xdddb.c:1238: undefined reference tomysql_store_result’
/tmp/cc1bZe5x.o(.text+0xdbc):…/xdata/xdddb.c:1242: undefined reference to mysql_fetch_row' /tmp/cc1bZe5x.o(.text+0xea0):../xdata/xdddb.c:1247: undefined reference tomysql_free_result’
/tmp/cc1bZe5x.o(.text+0xebb):…/xdata/xdddb.c:1280: undefined reference to mysql_free_result' collect2: ld returned 1 exit status make[1]: *** [nagios] Error 1 make[1]: Leaving directory/root/nagios-1.3/base’
make: *** [all] Error 2

Do you have any ideas how to resolve this issue?
Or would I be better off not installing Nagios 1.3 with MySQL support, but use event handlers instead to insert data into my MySQL database?


#11

[quote=“luca”]As for your problem i don’t remember how i did my first install of Nagios… (switched to 2b since) anyway checking debian packages i found two distinct mysql-dev and mysql-devel listed… could it be this?

Luca[/quote]

hm…i’m running suse 9.3


#12

Diffie: check you have all mysql packages installed… mysql-server mysql-common mysql-client and mysql-dev.

ivant: don’t know possily there are 2 different packages in suse too… not using rpm for a long time so i don’t remember how to check available packages :slight_smile:

Luca


#13

[quote=“jakkedup”]mysql-devel is installed right?
Show us the command and output that shows that.[/quote]

What I was looking for is the rpm command and the output that shows that you have the libs installed. It doesn’t look like it to me, so show me that I’m wrong.


#14

mysql --version
mysql Ver 14.7 Distrib 4.1.16, for pc-linux-gnu (i686) using readline 4.3

rpm -q mysql-devel
mysql-devel-4.1.10a-3

rpm -q MySQL-client-standard-4.1.16-1.sles9
MySQL-client-standard-4.1.16-1.sles9

./././././.
from yast

i │mysql-devel│4.1.10a│MySQL Development Header Files and Libraries│5.4 MB│
mysql-devel - MySQL Development Header Files and Libraries Version: 4.1.10a-3 Size: 5.4 MB Media No.: 0
License: GPL, Other License(s), see package Package Group: Development/Libraries/C and C++
Provides: mysqldev │
Authors:

-i- │MySQL-client-standard│4.1.16│MySQL - Client │ 14.8 MB
-i- │MySQL-shared-standard│4.1.14 │MySQL - Shared libraries│3.4 MB│
i │mysql-devel │4.1.10a│MySQL Development Header Files and Libraries│5.4 MB

hm…according to luca’s post i shoud have mysql-common installed but i couldn’t find it for suse (maybe it’s included in some other mysql packages that i have installed)