mirror of
https://github.com/outbackdingo/nDPId.git
synced 2026-01-27 10:19:45 +00:00
Add InfluxDB push daemon.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -82,6 +82,7 @@ option(ENABLE_ZLIB "Enable zlib support for nDPId (experimental)." OFF)
|
||||
option(ENABLE_SYSTEMD "Install systemd components." OFF)
|
||||
option(BUILD_EXAMPLES "Build C examples." ON)
|
||||
option(ENABLE_DBUS "Build DBus notification example." OFF)
|
||||
option(ENABLE_CURL "Build influxdb data write example." OFF)
|
||||
option(BUILD_NDPI "Clone and build nDPI from github." OFF)
|
||||
if(BUILD_NDPI)
|
||||
if(APPLE)
|
||||
@@ -179,6 +180,9 @@ endif()
|
||||
if(ENABLE_DBUS)
|
||||
pkg_check_modules(DBUS REQUIRED dbus-1)
|
||||
endif()
|
||||
if(ENABLE_CURL)
|
||||
pkg_check_modules(CURL REQUIRED libcurl)
|
||||
endif()
|
||||
if(NDPI_WITH_GCRYPT)
|
||||
message(STATUS "nDPI: Enable GCRYPT")
|
||||
set(NDPI_ADDITIONAL_ARGS "${NDPI_ADDITIONAL_ARGS} --with-local-libgcrypt")
|
||||
@@ -403,6 +407,18 @@ if(BUILD_EXAMPLES)
|
||||
install(TARGETS nDPIsrvd-notifyd DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CURL)
|
||||
add_executable(nDPIsrvd-influxd examples/c-influxd/c-influxd.c utils.c)
|
||||
if(BUILD_NDPI)
|
||||
add_dependencies(nDPIsrvd-influxd libnDPI)
|
||||
endif()
|
||||
target_include_directories(nDPIsrvd-influxd PRIVATE
|
||||
"${STATIC_LIBNDPI_INC}" "${DEFAULT_NDPI_INCLUDE}" "${CMAKE_SOURCE_DIR}" "${NDPID_DEPS_INC}"
|
||||
"${CURL_INCLUDE_DIRS}")
|
||||
target_link_libraries(nDPIsrvd-influxd "${CURL_LIBRARIES}")
|
||||
install(TARGETS nDPIsrvd-influxd DESTINATION bin)
|
||||
endif()
|
||||
|
||||
install(TARGETS nDPIsrvd-analysed nDPIsrvd-collectd nDPIsrvd-captured nDPIsrvd-json-dump nDPIsrvd-simple DESTINATION bin)
|
||||
install(FILES examples/c-collectd/plugin_nDPIsrvd.conf examples/c-collectd/rrdgraph.sh DESTINATION share/nDPId/nDPIsrvd-collectd)
|
||||
install(DIRECTORY examples/c-collectd/www DESTINATION share/nDPId/nDPIsrvd-collectd)
|
||||
@@ -471,6 +487,7 @@ message(STATUS "STATIC_LIBNDPI_INSTALLDIR: ${STATIC_LIBNDPI_INSTALLDIR}")
|
||||
endif()
|
||||
message(STATUS "BUILD_NDPI...............: ${BUILD_NDPI}")
|
||||
message(STATUS "ENABLE_DBUS..............: ${ENABLE_DBUS}")
|
||||
message(STATUS "ENABLE_CURL..............: ${ENABLE_CURL}")
|
||||
if(BUILD_NDPI)
|
||||
message(STATUS "NDPI_ADDITIONAL_ARGS.....: ${NDPI_ADDITIONAL_ARGS}")
|
||||
endif()
|
||||
|
||||
@@ -20,6 +20,11 @@ Used also by `tests/run_tests.sh` if available.
|
||||
A collecd-exec compatible middleware that gathers statistic values from nDPId.
|
||||
Used also by `tests/run_tests.sh` if available.
|
||||
|
||||
## c-influxd
|
||||
|
||||
An InfluxDB push daemon. It aggregates various statistics gathered from nDPId.
|
||||
The results are sent to a specified InfluxDB endpoint.
|
||||
|
||||
## c-notifyd
|
||||
|
||||
A notification daemon that sends information about suspicious flow events to DBUS.
|
||||
|
||||
1424
examples/c-influxd/c-influxd.c
Normal file
1424
examples/c-influxd/c-influxd.c
Normal file
File diff suppressed because it is too large
Load Diff
2
utils.c
2
utils.c
@@ -208,7 +208,7 @@ int daemonize_shutdown(char const * const pidfile)
|
||||
{
|
||||
if (daemonize != 0)
|
||||
{
|
||||
if (unlink(pidfile) != 0 && errno != ENOENT)
|
||||
if (pidfile != NULL && unlink(pidfile) != 0 && errno != ENOENT)
|
||||
{
|
||||
logger(1, "Could not unlink pidfile %s: %s", pidfile, strerror(errno));
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user