diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-05 15:10:13 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-05 15:10:13 +0000 |
commit | 469758fc1924b90db564688c4ddd516e471354c2 (patch) | |
tree | 225ea762e10ffcecec9d130a1f57ffbe0be48a04 | |
parent | 604ce300ed68ee4ac4fb6bcd74c2b4dec26cfb9e (diff) | |
download | zabbix-469758fc1924b90db564688c4ddd516e471354c2.tar.gz zabbix-469758fc1924b90db564688c4ddd516e471354c2.tar.xz zabbix-469758fc1924b90db564688c4ddd516e471354c2.zip |
- started development of Oracle support (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2802 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | configure.in | 51 | ||||
-rwxr-xr-x | go | 15 | ||||
-rw-r--r-- | include/db.h | 9 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/Makefile.am | 2 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 19 | ||||
-rw-r--r-- | src/zabbix_server/Makefile.am | 6 | ||||
-rw-r--r-- | src/zabbix_server/alerter/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_server/housekeeper/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_server/pinger/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_server/poller/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_server/timer/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_server/trapper/Makefile.am | 2 |
13 files changed, 94 insertions, 21 deletions
@@ -1,5 +1,6 @@ Changes for 1.1beta10: + - started development of Oracle support (Alexei) - added server's parameter UnreachableDelay (Alexei) - added server's parameter UnreachablePeriod (Alexei) - fixed wrong logic in processing of timeouts and network errors (Alexei) diff --git a/configure.in b/configure.in index d3c73902..48cd8b70 100644 --- a/configure.in +++ b/configure.in @@ -478,10 +478,57 @@ AM_CONDITIONAL(AGENT, test x$agent = xyes) have_db="no" if test "$server" = "yes"; then + AC_MSG_CHECKING(for Oracle support) + AC_ARG_WITH(oracle, + [ + What DBMS do you want to use (please select only one): + --with-oracle[=DIR] Include Oracle support. DIR is the Sqlora8 base + install directory, default is to search through + a number of common places for the Sqlora8 files.], + [ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + if test -f /home/zabbix/sqlora8/include/sqlora.h; then + ORACLE_INCDIR=/home/zabbix/sqlora8/include/ + ORACLE_LIBDIR=/home/zabbix/sqlora8/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Oracle directory - unable to find sqlora.h) + fi + else + if test -f $withval/include/mysql/mysql.h; then + ORACLE_INCDIR=$withval/include/mysql + ORACLE_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + ORACLE_INCDIR=$withval/include + ORACLE_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Oracle directory - unable to find mysql.h under $withval) + fi + fi + ORACLE_INCLUDE="-I$ORACLE_INCDIR -I/home/zabbix/sqlora8/lib/libsqlora8/include" + ORACLE_LFLAGS="-L$ORACLE_LIBDIR" + ORACLE_LIBS="-lsqlora8" + + AC_DEFINE(HAVE_ORACLE,1,[Define to 1 if MySQL should be enabled.]) + AC_MSG_RESULT(yes) + have_db="Oracle" + + else + AC_MSG_RESULT(no) + fi + ],[ + AC_MSG_RESULT(no) + ]) + AC_SUBST(ORACLE_INCLUDE) + AC_SUBST(ORACLE_LFLAGS) + AC_SUBST(ORACLE_LIBS) + + AC_MSG_CHECKING(for MySQL support) AC_ARG_WITH(mysql, [ - What DBMS do you want to use (please select only one): --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base install directory, default is to search through a number of common places for the MySQL files.], @@ -591,7 +638,7 @@ if test "$server" = "yes"; then AC_DEFINE(HAVE_PGSQL,1,[Define to 1 if PostgreSQL should be enabled.]) AC_MSG_RESULT(yes) - have_db="PostagreSQL" + have_db="PostgreSQL" else AC_MSG_RESULT(no) fi @@ -13,13 +13,13 @@ automake # Change ./configure options if needed #./configure --with-mysql --prefix=/home/zabbix/zabbix --with-net-snmp -rm -f config.guess config.sub depcomp install-sh missing +#rm -f config.guess config.sub depcomp install-sh missing -cp /usr/share/automake-1.9/config.guess config.guess -cp /usr/share/automake-1.9/config.sub config.sub -cp /usr/share/automake-1.9/depcomp depcomp -cp /usr/share/automake-1.9/install-sh install-sh -cp /usr/share/automake-1.9/missing missing +#cp /usr/share/automake-1.9/config.guess config.guess +#cp /usr/share/automake-1.9/config.sub config.sub +#cp /usr/share/automake-1.9/depcomp depcomp +#cp /usr/share/automake-1.9/install-sh install-sh +#cp /usr/share/automake-1.9/missing missing #cd ~zabbix #rm -f zabbix.tgz @@ -28,8 +28,9 @@ cp /usr/share/automake-1.9/missing missing echo Configuring... export CFLAGS="-Wall" #export CFLAGS="-Wall -pedantic" -./configure --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null #./configure --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null +#./configure --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null +./configure --enable-agent --enable-server --with-oracle --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null echo Cleaning... make clean 2>>WARNINGS >/dev/null echo Making... diff --git a/include/db.h b/include/db.h index bec61af6..a41f78a6 100644 --- a/include/db.h +++ b/include/db.h @@ -34,8 +34,8 @@ #define DB_HANDLE MYSQL #endif -#ifdef HAVE_PGSQL - #include "libpq-fe.h" +#ifdef HAVE_ORACLE + #include "sqlora.h" #endif extern char *CONFIG_DBHOST; @@ -73,6 +73,11 @@ extern int CONFIG_DBPORT; #define DBfree_result PQclear #endif +#ifdef HAVE_ORACLE + #define DB_RESULT sqlo_stmt_handle_t + #define DBfree_result sqlo_close +#endif + #define MAX_HOST_HOST_LEN 64 #define MAX_ITEM_KEY_LEN 64 diff --git a/src/libs/zbxdbhigh/Makefile.am b/src/libs/zbxdbhigh/Makefile.am index efa37f40..0c0e10b1 100644 --- a/src/libs/zbxdbhigh/Makefile.am +++ b/src/libs/zbxdbhigh/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @PGSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @PGSQL_INCLUDE@ @ORACLE_INCLUDE@ libzbxdbhigh_a_SOURCES=action.c graph.c item.c trigger.c host.c db.c lib_LIBRARIES=libzbxdbhigh.a libzbxdbhigh_a_LIBADD = ../zbxcommon/libzbxcommon.a diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index 1961f939..e0f87be9 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -41,6 +41,10 @@ PGconn *conn; #endif +#ifdef HAVE_ORACLE + sqlo_db_handle_t oracle; +#endif + extern void apply_actions(DB_TRIGGER *trigger,int alarmid,int trigger_value); extern void update_services(int triggerid, int status); @@ -93,6 +97,21 @@ void DBconnect(void) exit(FAIL); } #endif +#ifdef HAVE_ORACLE + if (SQLO_SUCCESS != sqlo_init(SQLO_OFF, 1, 100)) + { + zabbix_log(LOG_LEVEL_ERR, "Failed to init libsqlora8"); + exit(FAIL); + } + + /* login */ + if (SQLO_SUCCESS != sqlo_connect(&oracle, "scott/tiger")) + { + printf("Cannot login with %s\n", "scott/tiger"); + zabbix_log(LOG_LEVEL_ERR, "Cannot login with %s\n", "scott/tiger"); + exit(FAIL); + } +#endif } /* diff --git a/src/zabbix_server/Makefile.am b/src/zabbix_server/Makefile.am index 57ce3cbb..6450e565 100644 --- a/src/zabbix_server/Makefile.am +++ b/src/zabbix_server/Makefile.am @@ -1,8 +1,8 @@ SUBDIRS = alerter housekeeper pinger poller timer trapper -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @SNMP_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ @SNMP_INCLUDE@ bin_PROGRAMS = zabbix_server zabbix_server_SOURCES = evalfunc.c expression.c actions.c zlog.c functions.c server.c zabbix_server_LDADD = ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxsysinfo/@ARCH@/libzbxsysinfo2.a \ -../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcommon/libzbxcommon.a @MYSQL_LIBS@ @PGSQL_LIBS@ @LDAP_LIBS@ @SNMP_LIBS@ -zabbix_server_LDFLAGS=@MYSQL_LFLAGS@ @PGSQL_LFLAGS@ @LDAP_LFLAGS@ @SNMP_LFLAGS@ +../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcommon/libzbxcommon.a @MYSQL_LIBS@ @PGSQL_LIBS@ @ORACLE_LIBS@ @LDAP_LIBS@ @SNMP_LIBS@ +zabbix_server_LDFLAGS=@MYSQL_LFLAGS@ @PGSQL_LFLAGS@ @ORACLE_LFLAGS@ @LDAP_LFLAGS@ @SNMP_LFLAGS@ diff --git a/src/zabbix_server/alerter/Makefile.am b/src/zabbix_server/alerter/Makefile.am index a3b44d51..78a12d11 100644 --- a/src/zabbix_server/alerter/Makefile.am +++ b/src/zabbix_server/alerter/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ lib_LIBRARIES=libzbxalerter.a libzbxalerter_a_SOURCES=alerter.c libzbxalerter_a_LIBADD = ../../libs/zbxemail/libzbxemail.a diff --git a/src/zabbix_server/housekeeper/Makefile.am b/src/zabbix_server/housekeeper/Makefile.am index 2769399a..308827dc 100644 --- a/src/zabbix_server/housekeeper/Makefile.am +++ b/src/zabbix_server/housekeeper/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ lib_LIBRARIES=libzbxhousekeeper.a libzbxhousekeeper_a_SOURCES=housekeeper.c diff --git a/src/zabbix_server/pinger/Makefile.am b/src/zabbix_server/pinger/Makefile.am index 090491ba..64f8093e 100644 --- a/src/zabbix_server/pinger/Makefile.am +++ b/src/zabbix_server/pinger/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ lib_LIBRARIES=libzbxpinger.a libzbxpinger_a_SOURCES=pinger.c diff --git a/src/zabbix_server/poller/Makefile.am b/src/zabbix_server/poller/Makefile.am index c6ebe90e..103ba7a9 100644 --- a/src/zabbix_server/poller/Makefile.am +++ b/src/zabbix_server/poller/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @SNMP_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ @SNMP_INCLUDE@ lib_LIBRARIES=libzbxpoller.a libzbxpoller_a_SOURCES=checks_agent.c checks_internal.c checks_simple.c checks_snmp.c checks_aggregate.c poller.c diff --git a/src/zabbix_server/timer/Makefile.am b/src/zabbix_server/timer/Makefile.am index ed86b9b3..83bc2b5c 100644 --- a/src/zabbix_server/timer/Makefile.am +++ b/src/zabbix_server/timer/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ lib_LIBRARIES=libzbxtimer.a libzbxtimer_a_SOURCES=timer.c diff --git a/src/zabbix_server/trapper/Makefile.am b/src/zabbix_server/trapper/Makefile.am index 28b86a67..e5927f62 100644 --- a/src/zabbix_server/trapper/Makefile.am +++ b/src/zabbix_server/trapper/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS= -INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ +INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @ORACLE_INCLUDE@ lib_LIBRARIES=libzbxtrapper.a libzbxtrapper_a_SOURCES=active.c autoregister.h autoregister.c trapper.c libzbxtrapper_a_LIBADD = ../../libs/zbxdbhigh/libzbxdbhigh.a |