provide a configure switch for turning on/off dbreader/dbwriter

git-svn-id: file:///Users/braun/svn/vermont/trunk/vermont@767 aef3b71b-58ee-0310-9ba9-8811b9f0742f
This commit is contained in:
lothar 2007-02-27 16:56:36 +00:00
parent 946053603e
commit 4139039720
15 changed files with 82 additions and 6 deletions

20
README
View File

@ -23,6 +23,26 @@ After you created the configure script run
$ ./configure
$ make
There are some configure switches that you should now about:
--with-ipheader-offset=ARG
You need to adjust the value according to the network that you want to
monitor. The default value is 14 for ethernet devices. Other common values
are 4 (BSD loop back device) and 18 (Ethernet von VLAN)
--enable-netflow-v9
Enables NetFlow v9 support (turned on by default)
--enable-dprint
Enables the DPRINT message system in VERMONT. Turned off by default
--enable-db
Enables support for DBWriter and DBReader (turned off by default)
CONFIGURATION

1
TODO
View File

@ -1,3 +1,2 @@
- We need a configure switch for turning of the MYSQL dependend code
- Template management is performed via ObservationDomainId. It should be done
with the SourceID struct

View File

@ -162,6 +162,7 @@ void CollectorConfiguration::connect(Configuration* c)
return;
}
#ifdef DB_SUPPORT_ENABLED
DbWriterConfiguration* dbWriterConfiguration = dynamic_cast<DbWriterConfiguration*>(c);
if (dbWriterConfiguration) {
msg(MSG_DEBUG, "Adding DBwriter to IpfixCollector");
@ -172,6 +173,7 @@ void CollectorConfiguration::connect(Configuration* c)
msg(MSG_DEBUG, "Successfully set up connction between collector and dbwriter");
return;
}
#endif
throw std::runtime_error("Cannot connect " + c->getId() + " to a collector!");
}

View File

@ -6,7 +6,12 @@
* and datatype to store in table
* INS_WIDTH : Length of the string for insert statement in depency of count columns
*/
#ifdef DB_SUPPORT_ENABLED
#define STARTLEN 60
#define TABLE_WIDTH 16
#define COL_WIDTH 40
#define INS_WIDTH 25
#endif

View File

@ -1,3 +1,5 @@
#ifdef DB_SUPPORT_ENABLED
#include <string.h>
#include <stdlib.h>
#include "IpfixDbReader.h"
@ -560,3 +562,5 @@ void addIpfixDbReaderCallbacks(IpfixDbReader* ipfixDbReader, CallbackInfo handle
n * sizeof(CallbackInfo));
memcpy(&dbReader->callbackInfo[n-1], &handles, sizeof(CallbackInfo));
}
#endif

View File

@ -1,3 +1,5 @@
#ifdef DB_SUPPORT_ENABLED
#ifndef IPFIXDBREADER_H
#define IPFIXDBREADER_H
@ -80,3 +82,5 @@ void addIpfixDbReaderCallbacks(IpfixDbReader* ipfixDbReader, CallbackInfo handle
#endif
#endif

View File

@ -1,3 +1,5 @@
#ifdef DB_SUPPORT_ENABLED
#include <string.h>
#include <stdlib.h>
#include "IpfixDbWriter.h"
@ -883,3 +885,5 @@ CallbackInfo getIpfixDbWriterCallbackInfo(IpfixDbWriter *ipfixDbWriter) {
return ci;
}
#endif

View File

@ -1,3 +1,5 @@
#ifdef DB_SUPPORT_ENABLED
#ifndef IPFIXDBWRITER_H
#define IPFIXDBWRITER_H
@ -105,3 +107,4 @@ CallbackInfo getIpfixDbWriterCallbackInfo(IpfixDbWriter* ipfixDbWriter);
#endif
#endif

View File

@ -42,11 +42,21 @@ AM_PATH_XML2(2.4.0,,AC_MSG_ERROR([*** LibXML version $XML_VERSION not found!]))
# check for pthread
ACX_PTHREAD
# any mysql-version should be adequate
MYSQL_FOUND=AX_LIB_MYSQL([0.1])
if test "$MYSQL_VERSION" = ""; then
AC_MSG_ERROR([*** mysql client library not found. Please install it.])
fi
# enable dbwriter/dbreader support
# check for mysql client liebrary if enabled
AC_ARG_ENABLE([db],
[AS_HELP_STRING([--enable-db])],
[enable_db_support=check])
AS_IF([test "x$enable_db_support" = "xcheck"],
[AC_MSG_NOTICE([Enable dbwriter/dbreader support])
AC_DEFINE(DB_SUPPORT_ENABLED)
#any mysql-version should be adequate
MYSQL_FOUND=AX_LIB_MYSQL([0.1])
if test "$MYSQL_VERSION" = ""; then
AC_MSG_ERROR([*** mysql client library not found. Please install it.])
fi
],
[AC_MSG_NOTICE([DbReader/DbWriter support disabled])])
# check for libpcap
AC_CHECK_HEADER([pcap.h],

View File

@ -3,6 +3,7 @@
(C) by Lothar Braun <mail@lobraun.de>
*/
#ifdef DB_SUPPORT_ENABLED
#include "dbreader_configuration.h"
#include "exporter_configuration.h"
@ -103,3 +104,5 @@ void DbReaderConfiguration::startSystem()
startIpfixDbReader(ipfixDbReader);
msg(MSG_INFO, "DbReaderConfiguration: Successfully started dbReader");
}
#endif

View File

@ -3,6 +3,7 @@
(C) by Lothar Braun <mail@lobraun.de>
*/
#ifdef DB_SUPPORT_ENABLED
#ifndef _DBREADER_CONFIGURATION_H_
#define _DBREADER_CONFIGURATION_H_
@ -37,3 +38,5 @@ private:
};
#endif
#endif

View File

@ -3,6 +3,7 @@
(C) Lothar Braun <mail@lobraun.de>
*/
#ifdef DB_SUPPORT_ENABLED
#include "dbwriter_configuration.h"
#include "msg.h"
@ -87,3 +88,5 @@ void DbWriterConfiguration::startSystem()
startIpfixDbWriter(dbWriter);
msg(MSG_INFO, "DbWriterConfiguration: Successfully started dbWriter");
}
#endif

View File

@ -3,6 +3,8 @@
(C) Lothar Braun <mail@lobraun.de>
*/
#ifdef DB_SUPPORT_ENABLED
#ifndef _DBWRITER_CONFIGURATION_H_
#define _DBWRITER_CONFIGURATION_H_
@ -45,3 +47,5 @@ private:
};
#endif
#endif

View File

@ -118,9 +118,19 @@ IpfixConfiguration::IpfixConfiguration(const std::string& configFile)
} else if (xmlCompare(current, "collectingProcess")) {
conf = new CollectorConfiguration(document, current);
} else if (xmlCompare(current, "dbWriter")) {
#ifdef DB_SUPPORT_ENABLED
conf = new DbWriterConfiguration(document, current);
#else
msg(MSG_ERROR, "IpfixConfiguration: Vermont was compiled without "
"support for dbWriter. Ignoring entry in config file!");
#endif
} else if (xmlCompare(current, "dbReader")) {
#ifdef DB_SUPPORT_ENABLED
conf = new DbReaderConfiguration(document, current);
#else
msg(MSG_ERROR, "IpfixConfiguration: Vermont was compiled without "
"support for dbReader. Ignoring entry in conifg file!");
#endif
}
if (conf) {
subsystems[conf->getId()] = conf;

View File

@ -140,6 +140,7 @@ void MeteringConfiguration::connect(Configuration* c)
return;
}
#ifdef DB_SUPPORT_ENABLED
DbWriterConfiguration* dbWriterConfiguration = dynamic_cast<DbWriterConfiguration*>(c);
if (dbWriterConfiguration) {
if (!flowMetering) {
@ -160,6 +161,7 @@ void MeteringConfiguration::connect(Configuration* c)
getIpfixDbWriterCallbackInfo(dbWriterConfiguration->getDbWriter()));
return;
}
#endif
throw std::runtime_error("Cannot connect " + c->getId() + " to metering process!");
}