From 836b47cb7e99a977c5a23b059ca1d0b5065d310e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 24 Jul 2024 11:54:23 +0200 Subject: Merging upstream version 1.46.3. Signed-off-by: Daniel Baumann --- CMakeLists.txt | 4582 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 2860 insertions(+), 1722 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d70d470b..e8b7c4a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,1120 +1,1383 @@ - # SPDX-License-Identifier: GPL-3.0-or-later -# This file is only used for development (netdata in Clion) -# It can build netdata, but you are on your own... -cmake_minimum_required(VERSION 3.1.0) -project(netdata C CXX) +cmake_minimum_required(VERSION 3.13.0...3.28) -find_package(Threads REQUIRED) -find_package(PkgConfig REQUIRED) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/Modules") -include(CheckFunctionExists) -include(CheckLibraryExists) +include(NetdataVersion) +netdata_version() + +project(netdata + VERSION "${NETDATA_VERSION_MAJOR}.${NETDATA_VERSION_MINOR}.${NETDATA_VERSION_PATCH}.${NETDATA_VERSION_TWEAK}" + HOMEPAGE_URL "https://www.netdata.cloud" + LANGUAGES C CXX) +include(CMakeDependentOption) + +if(DEFINED BUILD_SHARED_LIBS) + if(NOT BUILD_SHARED_LIBS) + set(STATIC_BUILD TRUE) + endif() +endif() -# default is "Debug" -#set(CMAKE_BUILD_TYPE "Release") +if(STATIC_BUILD) + set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX}") + set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() -# set this to see the compilation commands -#set(CMAKE_VERBOSE_MAKEFILE 1) +find_package(PkgConfig REQUIRED) -# ----------------------------------------------------------------------------- -# Set compilation options according to build type +if(STATIC_BUILD) + list(APPEND PKG_CONFIG_EXECUTABLE "--static") +endif() set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata") -IF("${CMAKE_BUILD_TYPE}" MATCHES "Debug") - set(CXX_DEFAULT_CFLAGS "-O0 -g -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_DEV_MODE=1 -fstack-protector-all -fno-omit-frame-pointer") - message(STATUS "building for: debugging") -ELSE() - set(CXX_DEFAULT_CFLAGS "-O2") - message(STATUS "building for: release") - cmake_policy(SET CMP0069 "NEW") - include(CheckIPOSupported) - check_ipo_supported(RESULT ipo_supported OUTPUT error) - IF(${ipo_supported}) - message(STATUS "link time optimization: supported") - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - ELSE() - message(STATUS "link time optimization: not supported") - ENDIF() -ENDIF() - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O1 -ggdb -Wall -Wextra -Wformat-signedness -Werror=format-security -Wunused-result ${CXX_DEFAULT_CFLAGS}") - -# ----------------------------------------------------------------------------- -# O/S Detection - -# these are defined in common.h too -SET(LINUX False) -SET(FREEBSD False) -SET(MACOS False) - -# Detect the operating system -IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - SET(MACOS True) -ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - SET(FREEBSD True) -ELSE() - SET(LINUX True) -ENDIF() - -# show the operating system on the console -message(STATUS "system name: ${CMAKE_SYSTEM_NAME}") - -set(GENERATED_CONFIG_H_DIR ${CMAKE_BINARY_DIR}) -set(GENERATED_CONFIG_H ${GENERATED_CONFIG_H_DIR}/config.h) - -# ----------------------------------------------------------------------------- -# Math - -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} m) -set(NETDATA_REQUIRED_DEFINES "-DSTORAGE_WITH_MATH=1 ${NETDATA_REQUIRED_DEFINES}") - -# ----------------------------------------------------------------------------- -# Detect libuuid - -pkg_check_modules(UUID REQUIRED uuid) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${UUID_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${UUID_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS}) - -# ----------------------------------------------------------------------------- -# Detect libz - -pkg_check_modules(ZLIB REQUIRED zlib) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${ZLIB_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${ZLIB_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) - -# ----------------------------------------------------------------------------- -# libuv multi-platform support library with a focus on asynchronous I/O +option(USE_CXX_11 "Use C++11 instead of C++14 (should only be used on legacy systems that cannot support C++14, may disable some features)" False) +mark_as_advanced(USE_CXX_11) -pkg_check_modules(LIBUV REQUIRED libuv) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${LIBUV_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${LIBUV_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${LIBUV_INCLUDE_DIRS}) +if(USE_CXX_11) + set(CMAKE_CXX_STANDARD 11) +endif() -# ----------------------------------------------------------------------------- -# lz4 Extremely Fast Compression algorithm +set(CMAKE_C_STANDARD_REQUIRED On) +set(CMAKE_CXX_STANDARD_REQUIRED On) -pkg_check_modules(LIBLZ4 REQUIRED liblz4) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${LIBLZ4_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${LIBLZ4_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${LIBLZ4_INCLUDE_DIRS}) -# set(NETDATA_REQUIRED_DEFINES "${NETDATA_REQUIRED_DEFINES} -DENABLE_LZ4=1") +set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) -# ----------------------------------------------------------------------------- -# Judy General purpose dynamic array +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} judy) +include(NetdataCompilerFlags) -# ----------------------------------------------------------------------------- -# OpenSSL Cryptography and SSL/TLS Toolkit +set(CMAKE_EXPORT_COMPILE_COMMANDS On) -pkg_check_modules(OPENSSL REQUIRED openssl) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${OPENSSL_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${OPENSSL_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS}) -# set(NETDATA_REQUIRED_DEFINES "${NETDATA_REQUIRED_DEFINES} -DENABLE_HTTPS=1") +# Check for the mold linker and try to use it if available +option(USE_MOLD "If the MOLD linker is available on the system, use it instead of the default linker." TRUE) -# ----------------------------------------------------------------------------- -# JSON-C used to health +if(USE_MOLD) + message(CHECK_START "Searching for MOLD linker") + find_program(MOLD_LINKER NAMES ld.mold mold) -pkg_check_modules(JSON REQUIRED json-c) -set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${JSONC_CFLAGS_OTHER}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${JSON_LIBRARIES}) -set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS}) + if(MOLD_LINKER) + execute_process(COMMAND ${MOLD_LINKER} --version + RESULT_VARIABLE MOLD_VERSION_RESULT + OUTPUT_VARIABLE MOLD_VERSION) + if(NOT MOLD_VERSION_RESULT) + string(REPLACE "\n" "" MOLD_VERSION "${MOLD_VERSION}") + message(CHECK_PASS "found (version: ${MOLD_VERSION})") + message(STATUS "Using mold instead of the system default for linking.") + add_link_options("-fuse-ld=mold") + else() + message(CHECK_FAIL "failed") + endif() + else() + message(CHECK_FAIL "failed") + endif() +endif() -# ----------------------------------------------------------------------------- -# Detect libcap +set(CONFIG_H_DIR ${CMAKE_BINARY_DIR}) +set(CONFIG_H ${CONFIG_H_DIR}/config.h) + +# +# detect OS +# + +set(OS_FREEBSD False) +set(OS_LINUX False) +set(OS_MACOS False) +set(OS_WINDOWS False) +set(ALLOW_PLATFORM_SENSITIVE_OPTIONS True) + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(OS_MACOS True) + find_library(IOKIT IOKit) + find_library(FOUNDATION Foundation) + message(INFO " Compiling for MacOS... ") +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + set(OS_FREEBSD True) + message(INFO " Compiling for FreeBSD... ") +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(OS_LINUX True) + add_definitions(-D_GNU_SOURCE) + message(INFO " Compiling for Linux... ") + include(NetdataUtil) + netdata_identify_libc(LIBC_IMPLEMENTATION) + if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND LIBC_IMPLEMENTATION STREQUAL "musl") + set(ALLOW_PLATFORM_SENSITIVE_OPTIONS False) + endif() +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + set(OS_WINDOWS True) + add_definitions(-D_GNU_SOURCE) + + if($ENV{CLION_IDE}) + # clion needs these to find the includes + if("${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + if("$ENV{MSYSTEM}" STREQUAL "MSYS") + include_directories(c:/msys64/usr/include) + include_directories(c:/msys64/usr/include/w32api) + elseif("$ENV{MSYSTEM}" STREQUAL "MINGW64") + include_directories(c:/msys64/mingw64/include) + elseif("$ENV{MSYSTEM}" STREQUAL "UCRT64") + include_directories(c:/msys64/ucrt64/include) + endif() + endif() + endif() -IF(LINUX) - pkg_check_modules(CAP QUIET libcap) - # later we use: - # ${CAP_LIBRARIES} - # ${CAP_CFLAGS_OTHER} - # ${CAP_INCLUDE_DIRS} -ENDIF(LINUX) + message(INFO " Compiling for Windows (${CMAKE_SYSTEM_NAME}, MSYSTEM=$ENV{MSYSTEM})... ") +else() + message(FATAL_ERROR "Unknown/unsupported platform: ${CMAKE_SYSTEM_NAME} (Supported platforms: FreeBSD, Linux, macOS, Windows)") +endif() +# This is intended to make life easier for developers who are working on one +# specific feature. +option(DEFAULT_FEATURE_STATE "Specify the default state for most optional features" True) +mark_as_advanced(DEFAULT_FEATURE_STATE) + +# High-level features +option(ENABLE_ACLK "Enable Netdata Cloud support (ACLK)" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_CLOUD "Enable Netdata Cloud by default at runtime" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_DBENGINE "Enable dbengine metrics storage" True) + +# Data collection plugins +option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE}) + +cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD OR OS_MACOS" False) + +cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False) + +cmake_dependent_option(ENABLE_PLUGIN_CGROUP_NETWORK "Enable Linux CGroup network usage monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_DEBUGFS "Enable Linux DebugFS metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False) +mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS) +cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_LOGS_MANAGEMENT "Enable log collection and monitoring based on Fluent Bit" False "OS_LINUX AND ALLOW_PLATFORM_SENSITIVE_OPTIONS" False) +cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_SLABINFO "Enable Linux kernel SLAB allocator monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "Enable systemd journal log collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) +cmake_dependent_option(ENABLE_PLUGIN_XENSTAT "Enable Xen domain monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) + +# Metrics exporters +option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "Enable exporting to Prometheus via remote write API" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_EXPORTER_MONGODB "Enable exporting to MongoDB" ${DEFAULT_FEATURE_STATE}) + +# Vendoring +option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False) +option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False) +option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False) + +# Optional test code +cmake_dependent_option(ENABLE_LOGS_MANAGEMENT_TESTS "Enable test code for logs-management plugin." True "ENABLE_PLUGIN_LOGS_MANAGEMENT" False) +mark_as_advanced(ENABLE_LOGS_MANAGEMENT_TESTS) + +# Experimental features +option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False) +mark_as_advanced(ENABLE_WEBRTC) +option(ENABLE_H2O "Enable H2O web server (experimental)" True) +mark_as_advanced(ENABLE_H2O) + +# Other optional functionality +option(ENABLE_SENTRY "Build with Sentry Native crash reporting" False) +mark_as_advanced(ENABLE_SENTRY) + +option(BUILD_FOR_PACKAGING "Include component files for native packages" False) +mark_as_advanced(BUILD_FOR_PACKAGING) + +cmake_dependent_option(FORCE_LEGACY_LIBBPF "Force usage of libbpf 0.0.9 instead of the latest version." False "ENABLE_PLUGIN_EBPF" False) +mark_as_advanced(FORCE_LEGACY_LIBBPF) + +if(ENABLE_ACLK OR ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE) + set(NEED_PROTOBUF True) +else() + set(NEED_PROTOBUF False) +endif() -# ----------------------------------------------------------------------------- -# Detect libipmimonitoring +if(ENABLE_PLUGIN_GO) + include(NetdataGoTools) -IF(LINUX) - pkg_check_modules(IPMI libipmimonitoring) - # later we use: - # ${IPMI_LIBRARIES} - # ${IPMI_CFLAGS_OTHER} - # ${IPMI_INCLUDE_DIRS} -ENDIF(LINUX) + find_min_go_version("${CMAKE_SOURCE_DIR}/src/go") + find_package(Go "${MIN_GO_VERSION}" REQUIRED) +endif() -# ----------------------------------------------------------------------------- -# Detect libmnl -IF(LINUX) - pkg_check_modules(MNL libmnl) - # later we use: - # ${MNL_LIBRARIES} - # ${MNL_CFLAGS_OTHER} - # ${MNL_INCLUDE_DIRS} -ENDIF(LINUX) +if(ENABLE_WEBRTC) + include(FetchContent) + include(NetdataFetchContentExtra) + # ignore debhelper + set(FETCHCONTENT_FULLY_DISCONNECTED Off) -# ----------------------------------------------------------------------------- -# Detect libmnl + set(PREFER_SYSTEM_LIB True) + set(NO_MEDIA True) + set(NO_WEBSOCKET True) -pkg_check_modules(NFACCT libnetfilter_acct) -# later we use: -# ${NFACCT_LIBRARIES} -# ${NFACCT_CFLAGS_OTHER} -# ${NFACCT_INCLUDE_DIRS} + set(HAVE_LIBDATACHANNEL True) + FetchContent_Declare(libdatachannel + GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git + GIT_TAG v0.20.1 + CMAKE_ARGS ${NETDATA_PROPAGATE_TOOLCHAIN_ARGS} + ) + FetchContent_MakeAvailable(libdatachannel) +endif() -# ----------------------------------------------------------------------------- -# Detect libxenstat +if(NEED_PROTOBUF) + include(NetdataProtobuf) -pkg_check_modules(XENSTAT libxenstat) -# later we use: -# ${XENSTAT_LIBRARIES} -# ${XENSTAT_CFLAGS_OTHER} -# ${XENSTAT_INCLUDE_DIRS} + if(ENABLE_BUNDLED_PROTOBUF) + netdata_bundle_protobuf() + endif() +endif() +set(PKG_FILES_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/pkg-files") -# ----------------------------------------------------------------------------- -# Detect MacOS IOKit/Foundation framework +if(ENABLE_PLUGIN_EBPF) + include(NetdataLibBPF) + include(NetdataEBPFCORE) -IF(MACOS) - find_library(IOKIT IOKit) - find_library(FOUNDATION Foundation) - # later we use: - # ${FOUNDATION} - # ${IOKIT} -ENDIF(MACOS) + if(NOT OS_LINUX) + message(FATAL_ERROR "The eBPF plugin is not supported on non-Linux systems") + endif() + netdata_bundle_libbpf() + netdata_fetch_ebpf_co_re() +endif() -# ----------------------------------------------------------------------------- -# Detect libcrypto +# +# Libm +# -pkg_check_modules(CRYPTO libcrypto) -# later we use: -# ${CRYPTO_LIBRARIES} -# ${CRYPTO_CFLAGS_OTHER} -# ${CRYPTO_INCLUDE_DIRS} +# checks link with cmake required libs +cmake_policy(SET CMP0075 NEW) +include(CheckFunctionExists) -# ----------------------------------------------------------------------------- -# Detect libssl +check_function_exists(log10 HAVE_LOG10) +if(NOT HAVE_LOG10) + unset(HAVE_LOG10 CACHE) + list(APPEND CMAKE_REQUIRED_LIBRARIES m) + check_function_exists(log10 HAVE_LOG10) + if(HAVE_LOG10) + set(LINK_LIBM True) + else() + message(FATAL_ERROR "Can not use log10 with/without libm.") + endif() +endif() -pkg_check_modules(SSL libssl) -# later we use: -# ${SSL_LIBRARIES} -# ${SSL_CFLAGS_OTHER} -# ${SSL_INCLUDE_DIRS} +# +# Custom Modules +# +include(NetdataJSONC) +include(NetdataYAML) -# ----------------------------------------------------------------------------- -# Detect libcurl +if(ENABLE_LEGACY_EBPF_PROGRAMS) + include(NetdataEBPFLegacy) +endif() -pkg_check_modules(CURL libcurl) -# later we use: -# ${CURL_LIBRARIES} -# ${CURL_CFLAGS_OTHER} -# ${CURL_INCLUDE_DIRS} +if(ENABLE_SENTRY) + include(NetdataSentry) +endif() -# ----------------------------------------------------------------------------- -# Detect libcups +# +# Checks from custom modules +# -pkg_check_modules(CUPS libcups) -IF(NOT CUPS_LIBRARIES) - pkg_check_modules(CUPS cups) -ENDIF() +netdata_detect_jsonc() +netdata_detect_libyaml() -# later we use: -# ${CUPS_LIBRARIES} -# ${CUPS_CFLAGS_OTHER} -# ${CUPS_INCLUDE_DIRS} +if(ENABLE_LEGACY_EBPF_PROGRAMS) + netdata_fetch_legacy_ebpf_code() +endif() -# ----------------------------------------------------------------------------- -# Detect libaws-c-common - -find_library(HAVE_AWS_CHECKSUMS aws-checksums) -# later we use: -# ${HAVE_AWS_CHECKSUMS} - -# ----------------------------------------------------------------------------- -# Detect libaws-c-common - -find_library(HAVE_AWS_COMMON aws-c-common) -# later we use: -# ${HAVE_AWS_COMMON} - -# ----------------------------------------------------------------------------- -# Detect libaws-c-common - -find_library(HAVE_AWS_EVENT_STREAM aws-c-event-stream) -# later we use: -# ${HAVE_AWS_EVENT_STREAM} - -# ----------------------------------------------------------------------------- -# Detect libaws-cpp-sdk-core - -pkg_check_modules(AWS_CORE aws-cpp-sdk-core) -# later we use: -# ${AWS_CORE_LIBRARIES} -# ${AWS_CORE_CFLAGS_OTHER} -# ${AWS_CORE_INCLUDE_DIRS} - -# ----------------------------------------------------------------------------- -# Detect libaws-cpp-sdk-kinesis - -pkg_check_modules(KINESIS aws-cpp-sdk-kinesis) -# later we use: -# ${KINESIS_LIBRARIES} -# ${KINESIS_CFLAGS_OTHER} -# ${KINESIS_INCLUDE_DIRS} - -# ----------------------------------------------------------------------------- -# Detect libgrpc - -pkg_check_modules(GRPC grpc) -# later we use: -# ${GRPC_LIBRARIES} -# ${GRPC_CFLAGS_OTHER} -# ${GRPC_INCLUDE_DIRS} - -# ----------------------------------------------------------------------------- -# Detect libgoogleapis_cpp_pubsub_protos - -pkg_check_modules(PUBSUB google_cloud_cpp_pubsub_protos) -# later we use: -# ${PUBSUB_LIBRARIES} -# ${PUBSUB_CFLAGS_OTHER} -# ${PUBSUB_INCLUDE_DIRS} - -# ----------------------------------------------------------------------------- -# Detect libprotobuf - -pkg_check_modules(PROTOBUF protobuf>=3) -# later we use: -# ${PROTOBUF_LIBRARIES} -# ${PROTOBUF_CFLAGS_OTHER} -# ${PROTOBUF_INCLUDE_DIRS} - - -# ----------------------------------------------------------------------------- -# Detect libsnappy - -pkg_check_modules(SNAPPY snappy) -# later we use: -# ${SNAPPY_LIBRARIES} -# ${SNAPPY_CFLAGS_OTHER} -# ${SNAPPY_INCLUDE_DIRS} - - -# ----------------------------------------------------------------------------- -# Detect libmongoc - -pkg_check_modules(MONGOC libmongoc-1.0) -# later we use: -# ${MONGOC_LIBRARIES} -# ${MONGOC_CFLAGS_OTHER} -# ${MONGOC_INCLUDE_DIRS} - - -# ----------------------------------------------------------------------------- -# Detect libbpf -IF(LINUX AND EXISTS "${CMAKE_SOURCE_DIR}/externaldeps/libbpf/libbpf.a") - message(STATUS "libbpf library found") - pkg_check_modules(ELF REQUIRED libelf) - # later we use: - # ${ELF_LIBRARIES} - # ${ELF_CFLAGS_OTHER} - # ${ELF_INCLUDE_DIRS} - IF(ELF_LIBRARIES) - list(APPEND NETDATA_COMMON_CFLAGS ${ELF_CFLAGS_OTHER}) - list(INSERT NETDATA_COMMON_LIBRARIES 0 - ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/libbpf.a - ${ELF_LIBRARIES}) - list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${ELF_INCLUDE_DIRS}) - include_directories(BEFORE ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/include ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/include/uapi) - set(ENABLE_PLUGIN_EBPF True) - set(HAVE_LIBBPF True) - ELSE(ELF_LIBRARIES) - set(ENABLE_PLUGIN_EBPF False) - message(STATUS "ebpf plugin: disabled (requires libelf)") - ENDIF(ELF_LIBRARIES) -ENDIF() - -# ----------------------------------------------------------------------------- -# Detect ml dependencies -file(STRINGS "${CMAKE_SOURCE_DIR}/config.h" DEFINE_ENABLE_ML REGEX "^#define ENABLE_ML 1$") -IF(DEFINE_ENABLE_ML MATCHES ".+" AND - EXISTS "${CMAKE_SOURCE_DIR}/ml/dlib/dlib/all/source.cpp") - set(ENABLE_ML True) - list(APPEND NETDATA_COMMON_CFLAGS "-DDLIB_NO_GUI_SUPPORT") - list(APPEND NETDATA_COMMON_INCLUDE_DIRS "ml/dlib") -ELSE() - set(ENABLE_ML False) -ENDIF() +if(ENABLE_SENTRY) + netdata_bundle_sentry() +endif() -set(LIBJUDY_SOURCES - libnetdata/libjudy/src/Judy.h - libnetdata/libjudy/src/JudyCommon/JudyMalloc.c - libnetdata/libjudy/src/JudyCommon/JudyPrivate.h - libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h - libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h - libnetdata/libjudy/src/JudyL/JudyL.h - libnetdata/libjudy/src/JudyL/JudyLByCount.c - libnetdata/libjudy/src/JudyL/JudyLCascade.c - libnetdata/libjudy/src/JudyL/JudyLCount.c - libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c - libnetdata/libjudy/src/JudyL/JudyLDecascade.c - libnetdata/libjudy/src/JudyL/JudyLDel.c - libnetdata/libjudy/src/JudyL/JudyLFirst.c - libnetdata/libjudy/src/JudyL/JudyLFreeArray.c - libnetdata/libjudy/src/JudyL/j__udyLGet.c - libnetdata/libjudy/src/JudyL/JudyLGet.c - libnetdata/libjudy/src/JudyL/JudyLInsArray.c - libnetdata/libjudy/src/JudyL/JudyLIns.c - libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c - libnetdata/libjudy/src/JudyL/JudyLMallocIF.c - libnetdata/libjudy/src/JudyL/JudyLMemActive.c - libnetdata/libjudy/src/JudyL/JudyLMemUsed.c - libnetdata/libjudy/src/JudyL/JudyLNext.c - libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c - libnetdata/libjudy/src/JudyL/JudyLPrev.c - libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c - libnetdata/libjudy/src/JudyL/JudyLTables.c - libnetdata/libjudy/src/JudyHS/JudyHS.c) - -ADD_LIBRARY(judy STATIC - ${LIBJUDY_SOURCES}) - -include_directories(BEFORE ${CMAKE_SOURCE_DIR}/libnetdata/libjudy/src) +# +# check include files +# + +include(CheckIncludeFile) + +check_include_file("netinet/in.h" HAVE_NETINET_IN_H) +check_include_file("resolv.h" HAVE_RESOLV_H) +check_include_file("netdb.h" HAVE_NETDB_H) +check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H) +check_include_file("sys/stat.h" HAVE_SYS_STAT_H) +check_include_file("sys/vfs.h" HAVE_SYS_VFS_H) +check_include_file("sys/statfs.h" HAVE_SYS_STATFS_H) +check_include_file("linux/magic.h" HAVE_LINUX_MAGIC_H) +check_include_file("sys/mount.h" HAVE_SYS_MOUNT_H) +check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H) +check_include_file("inttypes.h" HAVE_INTTYPES_H) +check_include_file("stdint.h" HAVE_STDINT_H) +check_include_file("sys/capability.h" HAVE_SYS_CAPABILITY_H) +check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) +check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H) +check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H) +check_include_file("grp.h" HAVE_GRP_H) +check_include_file("pwd.h" HAVE_PWD_H) +check_include_file("net/if.h" HAVE_NET_IF_H) +check_include_file("poll.h" HAVE_POLL_H) +check_include_file("syslog.h" HAVE_SYSLOG_H) +check_include_file("sys/mman.h" HAVE_SYS_MMAN_H) +check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H) +check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) +check_include_file("sys/wait.h" HAVE_SYS_WAIT_H) +check_include_file("sys/un.h" HAVE_SYS_UN_H) +check_include_file("spawn.h" HAVE_SPAWN_H) + +# +# check symbols +# -target_include_directories(judy PUBLIC - libnetdata/libjudy/src - libnetdata/libjudy/src/JudyCommon) +include(CheckSymbolExists) +check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS) +check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV) +check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) +check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R) +check_symbol_exists(finite "math.h" HAVE_FINITE) +check_symbol_exists(isfinite "math.h" HAVE_ISFINITE) +check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM) + +check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP) +check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP) +check_function_exists(gettid HAVE_GETTID) +check_function_exists(waitid HAVE_WAITID) +check_function_exists(nice HAVE_NICE) +check_function_exists(recvmmsg HAVE_RECVMMSG) +check_function_exists(getpriority HAVE_GETPRIORITY) +check_function_exists(setenv HAVE_SETENV) +check_function_exists(strndup HAVE_STRNDUP) + +check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER) +check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER) +check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN) +check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX) + +check_function_exists(close_range HAVE_CLOSE_RANGE) +check_function_exists(backtrace HAVE_BACKTRACE) + +# +# check source compilation +# -target_include_directories(judy BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) -target_compile_definitions(judy PUBLIC - JU_64BIT - JUDYL) +set(CMAKE_REQUIRED_LIBRARIES pthread) +check_c_source_compiles(" +#define _GNU_SOURCE +#include +int main() { + char name[16]; + pthread_t thread = pthread_self(); + return pthread_getname_np(thread, name, sizeof(name)); +} +" HAVE_PTHREAD_GETNAME_NP) -target_compile_options(judy PUBLIC - -Wno-sign-compare - -Wno-implicit-fallthrough) +check_c_source_compiles(" +#include +#define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u') +int main() { + char type = mytype(0); + return 0; +} +" HAVE_C__GENERIC) -set(LIBJUDY_PREV_FILES - libnetdata/libjudy/src/JudyL/JudyLPrev.c - libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c) +check_c_source_compiles(" +#include +int main() { + mallopt(M_ARENA_MAX, 1); + mallopt(M_PERTURB, 0x5A); + return 0; +} +" HAVE_C_MALLOPT) -set(LIBJUDY_NEXT_FILES - libnetdata/libjudy/src/JudyL/JudyLNext.c - libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c) +check_c_source_compiles(" +#define _GNU_SOURCE +#include +#include +int main() { + accept4(0, NULL, NULL, 0); + return 0; +} +" HAVE_ACCEPT4) -set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV") -set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT") -set_source_files_properties(libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE") -set_source_files_properties(libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB") -set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/libnetdata/libjudy/src/JudyL") +check_c_source_compiles(" +#define _GNU_SOURCE +#include +int main() { + char x = *strerror_r(0, &x, sizeof(x)); return 0; +} +" STRERROR_R_CHAR_P) -# ----------------------------------------------------------------------------- -# netdata files +check_c_source_compiles(" +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +int main() { + setns(0, 0); return 0; +} +" HAVE_SETNS) + +check_cxx_source_compiles(" +int main() { + __atomic_load_8(nullptr, 0); + return 0; +} +" HAVE_BUILTIN_ATOMICS) -set(LIBNETDATA_FILES - libnetdata/adaptive_resortable_list/adaptive_resortable_list.c - libnetdata/adaptive_resortable_list/adaptive_resortable_list.h - libnetdata/config/appconfig.c - libnetdata/config/appconfig.h - libnetdata/aral/aral.c - libnetdata/aral/aral.h - libnetdata/avl/avl.c - libnetdata/avl/avl.h - libnetdata/buffer/buffer.c - libnetdata/buffer/buffer.h - libnetdata/circular_buffer/circular_buffer.c - libnetdata/circular_buffer/circular_buffer.h - libnetdata/clocks/clocks.c - libnetdata/clocks/clocks.h - libnetdata/completion/completion.c - libnetdata/completion/completion.h - libnetdata/dictionary/dictionary.c - libnetdata/dictionary/dictionary.h - libnetdata/eval/eval.c - libnetdata/eval/eval.h - libnetdata/gorilla/gorilla.cc - libnetdata/gorilla/gorilla.h - libnetdata/health/health.c - libnetdata/health/health.h - libnetdata/july/july.c - libnetdata/july/july.h - libnetdata/inlined.h - libnetdata/json/json.c - libnetdata/json/json.h - libnetdata/json/jsmn.c - libnetdata/json/jsmn.h - libnetdata/libnetdata.c - libnetdata/libnetdata.h - libnetdata/locks/locks.c - libnetdata/locks/locks.h - libnetdata/log/log.c - libnetdata/log/log.h - libnetdata/os.c - libnetdata/os.h - libnetdata/endian.h - libnetdata/onewayalloc/onewayalloc.c - libnetdata/onewayalloc/onewayalloc.h - libnetdata/popen/popen.c - libnetdata/popen/popen.h - libnetdata/procfile/procfile.c - libnetdata/procfile/procfile.h - libnetdata/required_dummies.h - libnetdata/socket/security.c - libnetdata/socket/security.h - libnetdata/simple_pattern/simple_pattern.c - libnetdata/simple_pattern/simple_pattern.h - libnetdata/socket/socket.c - libnetdata/socket/socket.h - libnetdata/statistical/statistical.c - libnetdata/statistical/statistical.h - libnetdata/storage_number/storage_number.c - libnetdata/storage_number/storage_number.h - libnetdata/string/string.c - libnetdata/string/string.h - libnetdata/threads/threads.c - libnetdata/threads/threads.h - libnetdata/url/url.c - libnetdata/url/url.h - libnetdata/dyn_conf/dyn_conf.c - libnetdata/dyn_conf/dyn_conf.h - libnetdata/string/utf8.h - libnetdata/worker_utilization/worker_utilization.c - libnetdata/worker_utilization/worker_utilization.h - libnetdata/facets/facets.c - libnetdata/facets/facets.h - libnetdata/functions_evloop/functions_evloop.h - libnetdata/functions_evloop/functions_evloop.c - libnetdata/http/http_defs.h - ) +check_c_source_compiles(" +void my_printf(char const *s, ...) __attribute__((format(gnu_printf, 1, 2))); +int main() { return 0; } +" HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF FAIL_REGEX "warning:") -IF(ENABLE_PLUGIN_EBPF) - list(APPEND LIBNETDATA_FILES - libnetdata/ebpf/ebpf.c - libnetdata/ebpf/ebpf.h) -ENDIF() +check_c_source_compiles(" +void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2))); +int main() { return 0; } +" HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF FAIL_REGEX "warning:") -add_library(libnetdata OBJECT ${LIBNETDATA_FILES}) +check_c_source_compiles(" +#include +#include +#include +void* my_alloc(size_t size) __attribute__((malloc)); +int main() { + void *x = my_alloc(1); + free(x); + return 0; +} +void* my_alloc(size_t size) { + void *ret = malloc(size); + if(!ret) exit(1); + return ret; +} +" HAVE_FUNC_ATTRIBUTE_MALLOC) -target_include_directories(libnetdata BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) +check_c_source_compiles(" +void my_function() __attribute__((noinline)); +int main() { my_function(); return 0; } +void my_function() { ; } +" HAVE_FUNC_ATTRIBUTE_NOINLINE) -set(APPS_PLUGIN_FILES - collectors/apps.plugin/apps_plugin.c) +check_c_source_compiles(" +void my_exit_function() __attribute__((noreturn)); +int main() { + my_exit_function(); // Call the noreturn function + return 0; +} +void my_exit_function() { + exit(1); +} +" HAVE_FUNC_ATTRIBUTE_NORETURN) -set(DEBUGFS_PLUGIN_FILES - collectors/debugfs.plugin/debugfs_plugin.c - collectors/debugfs.plugin/debugfs_plugin.h - collectors/debugfs.plugin/debugfs_extfrag.c - collectors/debugfs.plugin/debugfs_zswap.c - collectors/debugfs.plugin/sys_devices_virtual_powercap.c - ) +check_c_source_compiles(" +#include +#include +#include +void* my_alloc(size_t size) __attribute__((returns_nonnull)); +int main() { + void* ptr = my_alloc(10); + free(ptr); + return 0; +} +void* my_alloc(size_t size) { + void *ret = malloc(size); + if(!ret) exit(1); + return ret; +} +" HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL) -set(FREEBSD_PLUGIN_FILES - collectors/freebsd.plugin/plugin_freebsd.c - collectors/freebsd.plugin/plugin_freebsd.h - collectors/freebsd.plugin/freebsd_sysctl.c - collectors/freebsd.plugin/freebsd_getmntinfo.c - collectors/freebsd.plugin/freebsd_getifaddrs.c - collectors/freebsd.plugin/freebsd_devstat.c - collectors/freebsd.plugin/freebsd_kstat_zfs.c - collectors/freebsd.plugin/freebsd_ipfw.c - collectors/proc.plugin/zfs_common.c - collectors/proc.plugin/zfs_common.h - ) +check_c_source_compiles(" +int my_function() __attribute__((warn_unused_result)); +int main() { + return my_function(); +} +int my_function() { + return 1; +} +" HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT) + +if(OS_FREEBSD OR OS_MACOS) + set(HAVE_BUILTIN_ATOMICS True) +endif() -set(HEALTH_PLUGIN_FILES - health/health.c - health/health.h - health/health_config.c - health/health_json.c - health/health_log.c) - -set(IDLEJITTER_PLUGIN_FILES - collectors/idlejitter.plugin/plugin_idlejitter.c - ) +# openssl/crypto +set(ENABLE_OPENSSL True) +pkg_check_modules(TLS IMPORTED_TARGET openssl) + +if(NOT TARGET PkgConfig::TLS) + if(OS_MACOS) + execute_process(COMMAND + brew --prefix --installed openssl + RESULT_VARIABLE BREW_OPENSSL + OUTPUT_VARIABLE BREW_OPENSSL_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}")) + message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.") + endif() + + add_library(PkgConfig::CRYPTO IMPORTED) + set_target_properties(PkgConfig::CRYPTO + IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libcrypto.dylib + INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include) + + add_library(PkgConfig::TLS IMPORTED) + set_target_properties(PkgConfig::TLS + IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libssl.dylib + INTERFACE_LINK_LIBRARIES PkgConfig::CRYPTO + INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include) + else() + message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.") + endif() +else() + pkg_check_modules(CRYPTO IMPORTED_TARGET REQUIRED libcrypto) +endif() -set(CGROUPS_PLUGIN_FILES - collectors/cgroups.plugin/sys_fs_cgroup.c - collectors/cgroups.plugin/sys_fs_cgroup.h - ) +# +# figure out if we need protoc/protobuf +# -set(CGROUP_NETWORK_FILES - collectors/cgroups.plugin/cgroup-network.c - ) +if(NEED_PROTOBUF) + netdata_detect_protobuf() +endif() -set(DISKSPACE_PLUGIN_FILES - collectors/diskspace.plugin/plugin_diskspace.c - ) +# +# source files +# -set(TIMEX_PLUGIN_FILES - collectors/timex.plugin/plugin_timex.c - ) +set(LIBJUDY_PREV_FILES + src/libnetdata/libjudy/src/JudyL/JudyLPrev.c + src/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c +) -set(PROFILE_PLUGIN_FILES - collectors/profile.plugin/plugin_profile.cc - ) +set(LIBJUDY_NEXT_FILES + src/libnetdata/libjudy/src/JudyL/JudyLNext.c + src/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c +) -set(FREEIPMI_PLUGIN_FILES - collectors/freeipmi.plugin/freeipmi_plugin.c - ) +set(LIBJUDY_SOURCES + src/libnetdata/libjudy/src/Judy.h + src/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c + src/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h + src/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h + src/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h + src/libnetdata/libjudy/src/JudyL/JudyL.h + src/libnetdata/libjudy/src/JudyL/JudyLByCount.c + src/libnetdata/libjudy/src/JudyL/JudyLCascade.c + src/libnetdata/libjudy/src/JudyL/JudyLCount.c + src/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c + src/libnetdata/libjudy/src/JudyL/JudyLDecascade.c + src/libnetdata/libjudy/src/JudyL/JudyLDel.c + src/libnetdata/libjudy/src/JudyL/JudyLFirst.c + src/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c + src/libnetdata/libjudy/src/JudyL/j__udyLGet.c + src/libnetdata/libjudy/src/JudyL/JudyLGet.c + src/libnetdata/libjudy/src/JudyL/JudyLInsArray.c + src/libnetdata/libjudy/src/JudyL/JudyLIns.c + src/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c + src/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c + src/libnetdata/libjudy/src/JudyL/JudyLMemActive.c + src/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c + src/libnetdata/libjudy/src/JudyL/JudyLTables.c + src/libnetdata/libjudy/src/JudyHS/JudyHS.c + ${LIBJUDY_PREV_FILES} + ${LIBJUDY_NEXT_FILES} +) -set(NFACCT_PLUGIN_FILES - collectors/nfacct.plugin/plugin_nfacct.c - ) +set(LIBNETDATA_FILES + ${CONFIG_H} + src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.c + src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h + src/libnetdata/config/appconfig.c + src/libnetdata/config/appconfig.h + src/libnetdata/aral/aral.c + src/libnetdata/aral/aral.h + src/libnetdata/avl/avl.c + src/libnetdata/avl/avl.h + src/libnetdata/buffer/buffer.c + src/libnetdata/buffer/buffer.h + src/libnetdata/circular_buffer/circular_buffer.c + src/libnetdata/circular_buffer/circular_buffer.h + src/libnetdata/clocks/clocks.c + src/libnetdata/clocks/clocks.h + src/libnetdata/completion/completion.c + src/libnetdata/completion/completion.h + src/libnetdata/datetime/iso8601.c + src/libnetdata/datetime/iso8601.h + src/libnetdata/datetime/rfc7231.c + src/libnetdata/datetime/rfc7231.h + src/libnetdata/datetime/rfc3339.c + src/libnetdata/datetime/rfc3339.h + src/libnetdata/dictionary/dictionary.c + src/libnetdata/dictionary/dictionary.h + src/libnetdata/eval/eval.c + src/libnetdata/eval/eval.h + src/libnetdata/facets/facets.c + src/libnetdata/facets/facets.h + src/libnetdata/functions_evloop/functions_evloop.c + src/libnetdata/functions_evloop/functions_evloop.h + src/libnetdata/gorilla/gorilla.cc + src/libnetdata/gorilla/gorilla.h + src/libnetdata/july/july.c + src/libnetdata/july/july.h + src/libnetdata/inlined.h + src/libnetdata/json/json.c + src/libnetdata/json/json.h + src/libnetdata/json/jsmn.c + src/libnetdata/json/jsmn.h + src/libnetdata/libnetdata.c + src/libnetdata/libnetdata.h + src/libnetdata/line_splitter/line_splitter.c + src/libnetdata/line_splitter/line_splitter.h + src/libnetdata/libnetdata.h + src/libnetdata/locks/locks.c + src/libnetdata/locks/locks.h + src/libnetdata/log/journal.c + src/libnetdata/log/journal.h + src/libnetdata/log/log.c + src/libnetdata/log/log.h + src/libnetdata/os/os.c + src/libnetdata/os/os.h + src/libnetdata/simple_hashtable.h + src/libnetdata/os/byteorder.h + src/libnetdata/onewayalloc/onewayalloc.c + src/libnetdata/onewayalloc/onewayalloc.h + src/libnetdata/popen/popen.c + src/libnetdata/popen/popen.h + src/libnetdata/procfile/procfile.c + src/libnetdata/procfile/procfile.h + src/libnetdata/query_progress/progress.c + src/libnetdata/query_progress/progress.h + src/libnetdata/required_dummies.h + src/libnetdata/socket/security.c + src/libnetdata/socket/security.h + src/libnetdata/simple_pattern/simple_pattern.c + src/libnetdata/simple_pattern/simple_pattern.h + src/libnetdata/socket/socket.c + src/libnetdata/socket/socket.h + src/libnetdata/statistical/statistical.c + src/libnetdata/statistical/statistical.h + src/libnetdata/storage_number/storage_number.c + src/libnetdata/storage_number/storage_number.h + src/libnetdata/string/string.c + src/libnetdata/string/string.h + src/libnetdata/threads/threads.c + src/libnetdata/threads/threads.h + src/libnetdata/url/url.c + src/libnetdata/url/url.h + src/libnetdata/uuid/uuid.c + src/libnetdata/uuid/uuid.h + src/libnetdata/string/utf8.h + src/libnetdata/worker_utilization/worker_utilization.c + src/libnetdata/worker_utilization/worker_utilization.h + src/libnetdata/http/http_access.c + src/libnetdata/http/http_access.h + src/libnetdata/http/http_defs.c + src/libnetdata/http/http_defs.h + src/libnetdata/http/content_type.c + src/libnetdata/http/content_type.h + src/libnetdata/config/dyncfg.c + src/libnetdata/config/dyncfg.h + src/libnetdata/json/json-c-parser-inline.h + src/libnetdata/template-enum.h + src/libnetdata/dictionary/dictionary-internals.h + src/libnetdata/dictionary/dictionary-unittest.c + src/libnetdata/dictionary/thread-cache.c + src/libnetdata/dictionary/thread-cache.h + src/libnetdata/dictionary/dictionary-traversal.c + src/libnetdata/dictionary/dictionary-statistics.h + src/libnetdata/dictionary/dictionary-locks.h + src/libnetdata/dictionary/dictionary-refcount.h + src/libnetdata/dictionary/dictionary-hashtable.h + src/libnetdata/dictionary/dictionary-item.h + src/libnetdata/dictionary/dictionary-callbacks.h + src/libnetdata/linked-lists.h + src/libnetdata/storage-point.h + src/libnetdata/bitmap64.h + src/libnetdata/os/waitid.c + src/libnetdata/os/waitid.h + src/libnetdata/os/gettid.c + src/libnetdata/os/gettid.h + src/libnetdata/os/adjtimex.c + src/libnetdata/os/adjtimex.h + src/libnetdata/os/setresuid.c + src/libnetdata/os/setresuid.h + src/libnetdata/os/setresgid.c + src/libnetdata/os/setresgid.h + src/libnetdata/os/getgrouplist.c + src/libnetdata/os/getgrouplist.h + src/libnetdata/os/get_pid_max.c + src/libnetdata/os/get_pid_max.h + src/libnetdata/os/os-freebsd-wrappers.c + src/libnetdata/os/os-freebsd-wrappers.h + src/libnetdata/os/os-macos-wrappers.c + src/libnetdata/os/os-macos-wrappers.h + src/libnetdata/os/get_system_cpus.c + src/libnetdata/os/get_system_cpus.h + src/libnetdata/os/tinysleep.c + src/libnetdata/os/tinysleep.h + src/libnetdata/os/uuid_generate.c + src/libnetdata/os/uuid_generate.h + src/libnetdata/os/setenv.c + src/libnetdata/os/setenv.h + src/libnetdata/os/strndup.c + src/libnetdata/os/strndup.h +) -set(XENSTAT_PLUGIN_FILES - collectors/xenstat.plugin/xenstat_plugin.c +if(ENABLE_PLUGIN_EBPF) + list(APPEND LIBNETDATA_FILES + src/libnetdata/ebpf/ebpf.c + src/libnetdata/ebpf/ebpf.h ) +endif() -set(PERF_PLUGIN_FILES - collectors/perf.plugin/perf_plugin.c - ) +set(LIBH2O_FILES + src/web/server/h2o/libh2o/deps/cloexec/cloexec.c + src/web/server/h2o/libh2o/deps/libgkc/gkc.c + src/web/server/h2o/libh2o/deps/libyrmcds/close.c + src/web/server/h2o/libh2o/deps/libyrmcds/connect.c + src/web/server/h2o/libh2o/deps/libyrmcds/recv.c + src/web/server/h2o/libh2o/deps/libyrmcds/send.c + src/web/server/h2o/libh2o/deps/libyrmcds/send_text.c + src/web/server/h2o/libh2o/deps/libyrmcds/socket.c + src/web/server/h2o/libh2o/deps/libyrmcds/strerror.c + src/web/server/h2o/libh2o/deps/libyrmcds/text_mode.c + src/web/server/h2o/libh2o/deps/picohttpparser/picohttpparser.c + src/web/server/h2o/libh2o/lib/common/cache.c + src/web/server/h2o/libh2o/lib/common/file.c + src/web/server/h2o/libh2o/lib/common/filecache.c + src/web/server/h2o/libh2o/lib/common/hostinfo.c + src/web/server/h2o/libh2o/lib/common/http1client.c + src/web/server/h2o/libh2o/lib/common/memcached.c + src/web/server/h2o/libh2o/lib/common/memory.c + src/web/server/h2o/libh2o/lib/common/multithread.c + src/web/server/h2o/libh2o/lib/common/serverutil.c + src/web/server/h2o/libh2o/lib/common/socket.c + src/web/server/h2o/libh2o/lib/common/socketpool.c + src/web/server/h2o/libh2o/lib/common/string.c + src/web/server/h2o/libh2o/lib/common/time.c + src/web/server/h2o/libh2o/lib/common/timeout.c + src/web/server/h2o/libh2o/lib/common/url.c + src/web/server/h2o/libh2o/lib/core/config.c + src/web/server/h2o/libh2o/lib/core/configurator.c + src/web/server/h2o/libh2o/lib/core/context.c + src/web/server/h2o/libh2o/lib/core/headers.c + src/web/server/h2o/libh2o/lib/core/logconf.c + src/web/server/h2o/libh2o/lib/core/proxy.c + src/web/server/h2o/libh2o/lib/core/request.c + src/web/server/h2o/libh2o/lib/core/token.c + src/web/server/h2o/libh2o/lib/core/util.c + src/web/server/h2o/libh2o/lib/handler/access_log.c + src/web/server/h2o/libh2o/lib/handler/chunked.c + src/web/server/h2o/libh2o/lib/handler/compress.c + src/web/server/h2o/libh2o/lib/handler/compress/gzip.c + src/web/server/h2o/libh2o/lib/handler/errordoc.c + src/web/server/h2o/libh2o/lib/handler/expires.c + src/web/server/h2o/libh2o/lib/handler/fastcgi.c + src/web/server/h2o/libh2o/lib/handler/file.c + src/web/server/h2o/libh2o/lib/handler/headers.c + src/web/server/h2o/libh2o/lib/handler/mimemap.c + src/web/server/h2o/libh2o/lib/handler/proxy.c + src/web/server/h2o/libh2o/lib/handler/redirect.c + src/web/server/h2o/libh2o/lib/handler/reproxy.c + src/web/server/h2o/libh2o/lib/handler/throttle_resp.c + src/web/server/h2o/libh2o/lib/handler/status.c + src/web/server/h2o/libh2o/lib/handler/headers_util.c + src/web/server/h2o/libh2o/lib/handler/status/events.c + src/web/server/h2o/libh2o/lib/handler/status/requests.c + src/web/server/h2o/libh2o/lib/handler/http2_debug_state.c + src/web/server/h2o/libh2o/lib/handler/status/durations.c + src/web/server/h2o/libh2o/lib/handler/configurator/access_log.c + src/web/server/h2o/libh2o/lib/handler/configurator/compress.c + src/web/server/h2o/libh2o/lib/handler/configurator/errordoc.c + src/web/server/h2o/libh2o/lib/handler/configurator/expires.c + src/web/server/h2o/libh2o/lib/handler/configurator/fastcgi.c + src/web/server/h2o/libh2o/lib/handler/configurator/file.c + src/web/server/h2o/libh2o/lib/handler/configurator/headers.c + src/web/server/h2o/libh2o/lib/handler/configurator/proxy.c + src/web/server/h2o/libh2o/lib/handler/configurator/redirect.c + src/web/server/h2o/libh2o/lib/handler/configurator/reproxy.c + src/web/server/h2o/libh2o/lib/handler/configurator/throttle_resp.c + src/web/server/h2o/libh2o/lib/handler/configurator/status.c + src/web/server/h2o/libh2o/lib/handler/configurator/http2_debug_state.c + src/web/server/h2o/libh2o/lib/handler/configurator/headers_util.c + src/web/server/h2o/libh2o/lib/http1.c + src/web/server/h2o/libh2o/lib/tunnel.c + src/web/server/h2o/libh2o/lib/http2/cache_digests.c + src/web/server/h2o/libh2o/lib/http2/casper.c + src/web/server/h2o/libh2o/lib/http2/connection.c + src/web/server/h2o/libh2o/lib/http2/frame.c + src/web/server/h2o/libh2o/lib/http2/hpack.c + src/web/server/h2o/libh2o/lib/http2/scheduler.c + src/web/server/h2o/libh2o/lib/http2/stream.c + src/web/server/h2o/libh2o/lib/http2/http2_debug_state.c +) -set(SLABINFO_PLUGIN_FILES - collectors/slabinfo.plugin/slabinfo.c - ) +set(DAEMON_FILES + src/daemon/buildinfo.c + src/daemon/buildinfo.h + src/daemon/common.c + src/daemon/common.h + src/daemon/daemon.c + src/daemon/daemon.h + src/daemon/event_loop.c + src/daemon/event_loop.h + src/daemon/global_statistics.c + src/daemon/global_statistics.h + src/daemon/analytics.c + src/daemon/analytics.h + src/daemon/main.c + src/daemon/main.h + src/daemon/signals.c + src/daemon/signals.h + src/daemon/service.c + src/daemon/watcher.c + src/daemon/watcher.h + src/daemon/static_threads.c + src/daemon/static_threads.h + src/daemon/commands.c + src/daemon/commands.h + src/daemon/pipename.c + src/daemon/pipename.h + src/daemon/unit_test.c + src/daemon/unit_test.h + src/daemon/config/dyncfg.c + src/daemon/config/dyncfg.h + src/daemon/config/dyncfg-files.c + src/daemon/config/dyncfg-unittest.c + src/daemon/config/dyncfg-inline.c + src/daemon/config/dyncfg-echo.c + src/daemon/config/dyncfg-internals.h + src/daemon/config/dyncfg-intercept.c + src/daemon/config/dyncfg-tree.c +) -set(CUPS_PLUGIN_FILES - collectors/cups.plugin/cups_plugin.c - ) +set(H2O_FILES + src/web/server/h2o/http_server.c + src/web/server/h2o/http_server.h + src/web/server/h2o/h2o_utils.c + src/web/server/h2o/h2o_utils.h + src/web/server/h2o/streaming.c + src/web/server/h2o/streaming.h + src/web/server/h2o/connlist.c + src/web/server/h2o/connlist.h +) -set(EBPF_PROCESS_PLUGIN_FILES - collectors/ebpf.plugin/ebpf.c - collectors/ebpf.plugin/ebpf.h - collectors/ebpf.plugin/ebpf_cachestat.c - collectors/ebpf.plugin/ebpf_cachestat.h - collectors/ebpf.plugin/ebpf_dcstat.c - collectors/ebpf.plugin/ebpf_dcstat.h - collectors/ebpf.plugin/ebpf_disk.c - collectors/ebpf.plugin/ebpf_disk.h - collectors/ebpf.plugin/ebpf_fd.c - collectors/ebpf.plugin/ebpf_fd.h - collectors/ebpf.plugin/ebpf_hardirq.c - collectors/ebpf.plugin/ebpf_hardirq.h - collectors/ebpf.plugin/ebpf_mdflush.c - collectors/ebpf.plugin/ebpf_mdflush.h - collectors/ebpf.plugin/ebpf_mount.c - collectors/ebpf.plugin/ebpf_mount.h - collectors/ebpf.plugin/ebpf_filesystem.c - collectors/ebpf.plugin/ebpf_filesystem.h - collectors/ebpf.plugin/ebpf_oomkill.c - collectors/ebpf.plugin/ebpf_oomkill.h - collectors/ebpf.plugin/ebpf_process.c - collectors/ebpf.plugin/ebpf_process.h - collectors/ebpf.plugin/ebpf_shm.c - collectors/ebpf.plugin/ebpf_shm.h - collectors/ebpf.plugin/ebpf_socket.c - collectors/ebpf.plugin/ebpf_socket.h - collectors/ebpf.plugin/ebpf_softirq.c - collectors/ebpf.plugin/ebpf_softirq.h - collectors/ebpf.plugin/ebpf_sync.c - collectors/ebpf.plugin/ebpf_sync.h - collectors/ebpf.plugin/ebpf_swap.c - collectors/ebpf.plugin/ebpf_swap.h - collectors/ebpf.plugin/ebpf_vfs.c - collectors/ebpf.plugin/ebpf_vfs.h - collectors/ebpf.plugin/ebpf_apps.c - collectors/ebpf.plugin/ebpf_apps.h - collectors/ebpf.plugin/ebpf_cgroup.c - collectors/ebpf.plugin/ebpf_cgroup.h - collectors/ebpf.plugin/ebpf_unittest.c - collectors/ebpf.plugin/ebpf_unittest.h - collectors/ebpf.plugin/ebpf_functions.c - collectors/ebpf.plugin/ebpf_functions.h - ) +if(ENABLE_H2O) + list(APPEND DAEMON_FILES ${H2O_FILES}) +endif() -set(PROC_PLUGIN_FILES - collectors/proc.plugin/ipc.c - collectors/proc.plugin/plugin_proc.c - collectors/proc.plugin/plugin_proc.h - collectors/proc.plugin/proc_diskstats.c - collectors/proc.plugin/proc_mdstat.c - collectors/proc.plugin/proc_interrupts.c - collectors/proc.plugin/proc_softirqs.c - collectors/proc.plugin/proc_loadavg.c - collectors/proc.plugin/proc_meminfo.c - collectors/proc.plugin/proc_pagetypeinfo.c - collectors/proc.plugin/proc_net_dev.c - collectors/proc.plugin/proc_net_wireless.c - collectors/proc.plugin/proc_net_ip_vs_stats.c - collectors/proc.plugin/proc_net_netstat.c - collectors/proc.plugin/proc_net_rpc_nfs.c - collectors/proc.plugin/proc_net_rpc_nfsd.c - collectors/proc.plugin/proc_net_sctp_snmp.c - collectors/proc.plugin/proc_net_sockstat.c - collectors/proc.plugin/proc_net_sockstat6.c - collectors/proc.plugin/proc_net_softnet_stat.c - collectors/proc.plugin/proc_net_stat_conntrack.c - collectors/proc.plugin/proc_net_stat_synproxy.c - collectors/proc.plugin/proc_self_mountinfo.c - collectors/proc.plugin/proc_self_mountinfo.h - collectors/proc.plugin/zfs_common.c - collectors/proc.plugin/zfs_common.h - collectors/proc.plugin/proc_spl_kstat_zfs.c - collectors/proc.plugin/proc_stat.c - collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c - collectors/proc.plugin/proc_vmstat.c - collectors/proc.plugin/proc_uptime.c - collectors/proc.plugin/proc_pressure.c - collectors/proc.plugin/proc_pressure.h - collectors/proc.plugin/sys_kernel_mm_ksm.c - collectors/proc.plugin/sys_block_zram.c - collectors/proc.plugin/sys_devices_system_edac_mc.c - collectors/proc.plugin/sys_devices_system_node.c - collectors/proc.plugin/sys_class_infiniband.c - collectors/proc.plugin/sys_fs_btrfs.c - collectors/proc.plugin/sys_class_power_supply.c - collectors/proc.plugin/sys_devices_pci_aer.c - collectors/proc.plugin/sys_class_drm.c - ) +set(API_PLUGIN_FILES + src/web/api/web_api.c + src/web/api/web_api.h + src/web/api/web_api_v1.c + src/web/api/web_api_v1.h + src/web/api/web_api_v2.c + src/web/api/web_api_v2.h + src/web/api/http_auth.c + src/web/api/http_auth.h + src/web/api/http_header.c + src/web/api/http_header.h + src/web/api/badges/web_buffer_svg.c + src/web/api/badges/web_buffer_svg.h + src/web/api/exporters/allmetrics.c + src/web/api/exporters/allmetrics.h + src/web/api/exporters/shell/allmetrics_shell.c + src/web/api/exporters/shell/allmetrics_shell.h + src/web/api/queries/rrdr.c + src/web/api/queries/rrdr.h + src/web/api/queries/query.c + src/web/api/queries/query.h + src/web/api/queries/average/average.c + src/web/api/queries/average/average.h + src/web/api/queries/countif/countif.c + src/web/api/queries/countif/countif.h + src/web/api/queries/incremental_sum/incremental_sum.c + src/web/api/queries/incremental_sum/incremental_sum.h + src/web/api/queries/max/max.c + src/web/api/queries/max/max.h + src/web/api/queries/min/min.c + src/web/api/queries/min/min.h + src/web/api/queries/sum/sum.c + src/web/api/queries/sum/sum.h + src/web/api/queries/median/median.c + src/web/api/queries/median/median.h + src/web/api/queries/percentile/percentile.c + src/web/api/queries/percentile/percentile.h + src/web/api/queries/stddev/stddev.c + src/web/api/queries/stddev/stddev.h + src/web/api/queries/ses/ses.c + src/web/api/queries/ses/ses.h + src/web/api/queries/des/des.c + src/web/api/queries/des/des.h + src/web/api/queries/trimmed_mean/trimmed_mean.c + src/web/api/queries/trimmed_mean/trimmed_mean.h + src/web/api/queries/weights.c + src/web/api/queries/weights.h + src/web/api/formatters/rrd2json.c + src/web/api/formatters/rrd2json.h + src/web/api/formatters/csv/csv.c + src/web/api/formatters/csv/csv.h + src/web/api/formatters/json/json.c + src/web/api/formatters/json/json.h + src/web/api/formatters/ssv/ssv.c + src/web/api/formatters/ssv/ssv.h + src/web/api/formatters/value/value.c + src/web/api/formatters/value/value.h + src/web/api/formatters/json_wrapper.c + src/web/api/formatters/json_wrapper.h + src/web/api/formatters/charts2json.c + src/web/api/formatters/charts2json.h + src/web/api/formatters/rrdset2json.c + src/web/api/formatters/rrdset2json.h + src/web/api/ilove/ilove.c + src/web/api/ilove/ilove.h + src/web/rtc/webrtc.c + src/web/rtc/webrtc.h +) -set(TC_PLUGIN_FILES - collectors/tc.plugin/plugin_tc.c - ) +set(EXPORTING_ENGINE_FILES + src/exporting/exporting_engine.c + src/exporting/exporting_engine.h + src/exporting/graphite/graphite.c + src/exporting/graphite/graphite.h + src/exporting/json/json.c + src/exporting/json/json.h + src/exporting/opentsdb/opentsdb.c + src/exporting/opentsdb/opentsdb.h + src/exporting/prometheus/prometheus.c + src/exporting/prometheus/prometheus.h + src/exporting/read_config.c + src/exporting/clean_connectors.c + src/exporting/init_connectors.c + src/exporting/process_data.c + src/exporting/check_filters.c + src/exporting/send_data.c + src/exporting/send_internal_metrics.c +) -set(MACOS_PLUGIN_FILES - collectors/macos.plugin/plugin_macos.c - collectors/macos.plugin/plugin_macos.h - collectors/macos.plugin/macos_sysctl.c - collectors/macos.plugin/macos_mach_smi.c - collectors/macos.plugin/macos_fw.c +set(HEALTH_PLUGIN_FILES + src/health/health.c + src/health/health.h + src/health/health_config.c + src/health/health_json.c + src/health/health_log.c + src/health/health_prototypes.c + src/health/health_prototypes.h + src/health/health_silencers.c + src/health/health_silencers.h + src/health/health_internals.h + src/health/health_notifications.c + src/health/health_event_loop.c + src/health/health_dyncfg.c + src/health/health_variable.c + src/health/rrdcalc.c + src/health/rrdcalc.h + src/health/rrdvar.c + src/health/rrdvar.h +) + +set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c) + +if(ENABLE_ML) + set(ML_FILES + src/ml/ad_charts.h + src/ml/ad_charts.cc + src/ml/Config.cc + src/ml/dlib/dlib/all/source.cpp + src/ml/ml.h + src/ml/ml.cc + src/ml/ml-private.h ) +else() + set(ML_FILES + src/ml/ml.h + src/ml/ml-dummy.c + ) +endif() + +set(INTERNAL_COLLECTORS_FILES + src/collectors/common-contexts/common-contexts.h + src/collectors/common-contexts/disk.io.h + src/collectors/common-contexts/system.io.h + src/collectors/common-contexts/system.processes.h + src/collectors/common-contexts/system.ram.h + src/collectors/common-contexts/mem.swap.h + src/collectors/common-contexts/mem.pgfaults.h + src/collectors/common-contexts/mem.available.h +) set(PLUGINSD_PLUGIN_FILES - collectors/plugins.d/plugins_d.c - collectors/plugins.d/plugins_d.h - collectors/plugins.d/pluginsd_parser.c - collectors/plugins.d/pluginsd_parser.h - ) + src/collectors/plugins.d/plugins_d.c + src/collectors/plugins.d/plugins_d.h + src/collectors/plugins.d/pluginsd_dyncfg.c + src/collectors/plugins.d/pluginsd_dyncfg.h + src/collectors/plugins.d/pluginsd_functions.c + src/collectors/plugins.d/pluginsd_functions.h + src/collectors/plugins.d/pluginsd_internals.c + src/collectors/plugins.d/pluginsd_internals.h + src/collectors/plugins.d/pluginsd_parser.c + src/collectors/plugins.d/pluginsd_parser.h + src/collectors/plugins.d/pluginsd_replication.c + src/collectors/plugins.d/pluginsd_replication.h +) + +set(RRD_PLUGIN_FILES + src/database/contexts/api_v1.c + src/database/contexts/api_v2.c + src/database/contexts/context.c + src/database/contexts/instance.c + src/database/contexts/internal.h + src/database/contexts/metric.c + src/database/contexts/query_scope.c + src/database/contexts/query_target.c + src/database/contexts/rrdcontext.c + src/database/contexts/rrdcontext.h + src/database/contexts/worker.c + src/database/rrdcollector.c + src/database/rrdcollector.h + src/database/rrddim.c + src/database/rrdfunctions.c + src/database/rrdfunctions.h + src/database/rrdfunctions-inline.c + src/database/rrdfunctions-inline.h + src/database/rrdfunctions-progress.c + src/database/rrdfunctions-progress.h + src/database/rrdfunctions-streaming.c + src/database/rrdfunctions-streaming.h + src/database/rrdhost.c + src/database/rrdlabels.c + src/database/rrd.c + src/database/rrd.h + src/database/rrdset.c + src/database/storage_engine.c + src/database/storage_engine.h + src/database/ram/rrddim_mem.c + src/database/ram/rrddim_mem.h + src/database/sqlite/sqlite_metadata.c + src/database/sqlite/sqlite_metadata.h + src/database/sqlite/sqlite_functions.c + src/database/sqlite/sqlite_functions.h + src/database/sqlite/sqlite_context.c + src/database/sqlite/sqlite_context.h + src/database/sqlite/sqlite_db_migration.c + src/database/sqlite/sqlite_db_migration.h + src/database/sqlite/sqlite_aclk.c + src/database/sqlite/sqlite_aclk.h + src/database/sqlite/sqlite_health.c + src/database/sqlite/sqlite_health.h + src/database/sqlite/sqlite_aclk_node.c + src/database/sqlite/sqlite_aclk_node.h + src/database/sqlite/sqlite_aclk_alert.c + src/database/sqlite/sqlite_aclk_alert.h + src/database/sqlite/sqlite3.c + src/database/sqlite/sqlite3.h + src/database/sqlite/sqlite3recover.c + src/database/sqlite/sqlite3recover.h + src/database/sqlite/dbdata.c + src/database/KolmogorovSmirnovDist.c + src/database/KolmogorovSmirnovDist.h + src/database/rrdfunctions-inflight.c + src/database/rrdfunctions-inflight.h + src/database/rrdfunctions-exporters.c + src/database/rrdfunctions-exporters.h + src/database/rrdfunctions-internals.h + src/database/rrdcollector-internals.h +) + +if(ENABLE_DBENGINE) + list(APPEND RRD_PLUGIN_FILES + src/database/engine/rrdengine.c + src/database/engine/rrdengine.h + src/database/engine/rrddiskprotocol.h + src/database/engine/datafile.c + src/database/engine/datafile.h + src/database/engine/journalfile.c + src/database/engine/journalfile.h + src/database/engine/rrdenginelib.c + src/database/engine/rrdenginelib.h + src/database/engine/rrdengineapi.c + src/database/engine/rrdengineapi.h + src/database/engine/pagecache.c + src/database/engine/pagecache.h + src/database/engine/page_test.cc + src/database/engine/page.c + src/database/engine/page.h + src/database/engine/cache.c + src/database/engine/cache.h + src/database/engine/metric.c + src/database/engine/metric.h + src/database/engine/pdc.c + src/database/engine/pdc.h + src/database/engine/dbengine-unittest.c + src/database/engine/dbengine-stresstest.c + src/database/engine/dbengine-compression.c + src/database/engine/dbengine-compression.h + ) +endif() set(REGISTRY_PLUGIN_FILES - registry/registry.c - registry/registry.h - registry/registry_db.c - registry/registry_init.c - registry/registry_internals.c - registry/registry_internals.h - registry/registry_log.c - registry/registry_machine.c - registry/registry_machine.h - registry/registry_person.c - registry/registry_person.h - ) + src/registry/registry.c + src/registry/registry.h + src/registry/registry_db.c + src/registry/registry_init.c + src/registry/registry_internals.c + src/registry/registry_internals.h + src/registry/registry_log.c + src/registry/registry_machine.c + src/registry/registry_machine.h + src/registry/registry_person.c + src/registry/registry_person.h +) set(STATSD_PLUGIN_FILES - collectors/statsd.plugin/statsd.c - ) + src/collectors/statsd.plugin/statsd.c +) set(SYSTEMD_JOURNAL_PLUGIN_FILES - collectors/systemd-journal.plugin/systemd-journal.c - ) + src/collectors/systemd-journal.plugin/systemd-journal.c + src/collectors/systemd-journal.plugin/systemd-internals.h + src/collectors/systemd-journal.plugin/systemd-main.c + src/collectors/systemd-journal.plugin/systemd-units.c + src/collectors/systemd-journal.plugin/systemd-journal.c + src/collectors/systemd-journal.plugin/systemd-journal-annotations.c + src/collectors/systemd-journal.plugin/systemd-journal-files.c + src/collectors/systemd-journal.plugin/systemd-journal-fstat.c + src/collectors/systemd-journal.plugin/systemd-journal-watcher.c + src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c + src/libnetdata/maps/system-users.h + src/libnetdata/maps/system-groups.h +) -set(RRD_PLUGIN_FILES - database/contexts/api_v1.c - database/contexts/api_v2.c - database/contexts/context.c - database/contexts/instance.c - database/contexts/internal.h - database/contexts/metric.c - database/contexts/query_scope.c - database/contexts/query_target.c - database/contexts/rrdcontext.c - database/contexts/rrdcontext.h - database/contexts/worker.c - database/rrdcalc.c - database/rrdcalc.h - database/rrdcalctemplate.c - database/rrdcalctemplate.h - database/rrddim.c - database/rrddimvar.c - database/rrddimvar.h - database/rrdfamily.c - database/rrdfunctions.c - database/rrdfunctions.h - database/rrdhost.c - database/rrdlabels.c - database/rrdlabels.h - database/rrd.c - database/rrd.h - database/rrdset.c - database/rrdsetvar.c - database/rrdsetvar.h - database/rrdvar.c - database/rrdvar.h - database/storage_engine.c - database/storage_engine.h - database/ram/rrddim_mem.c - database/ram/rrddim_mem.h - database/sqlite/sqlite_metadata.c - database/sqlite/sqlite_metadata.h - database/sqlite/sqlite_functions.c - database/sqlite/sqlite_functions.h - database/sqlite/sqlite_context.c - database/sqlite/sqlite_context.h - database/sqlite/sqlite_db_migration.c - database/sqlite/sqlite_db_migration.h - database/sqlite/sqlite_aclk.c - database/sqlite/sqlite_aclk.h - database/sqlite/sqlite_health.c - database/sqlite/sqlite_health.h - database/sqlite/sqlite_aclk_node.c - database/sqlite/sqlite_aclk_node.h - database/sqlite/sqlite_aclk_alert.c - database/sqlite/sqlite_aclk_alert.h - database/sqlite/sqlite3.c - database/sqlite/sqlite3.h - database/sqlite/sqlite3recover.c - database/sqlite/sqlite3recover.h - database/sqlite/dbdata.c - database/engine/rrdengine.c - database/engine/rrdengine.h - database/engine/rrddiskprotocol.h - database/engine/datafile.c - database/engine/datafile.h - database/engine/journalfile.c - database/engine/journalfile.h - database/engine/rrdenginelib.c - database/engine/rrdenginelib.h - database/engine/rrdengineapi.c - database/engine/rrdengineapi.h - database/engine/pagecache.c - database/engine/pagecache.h - database/engine/cache.c - database/engine/cache.h - database/engine/metric.c - database/engine/metric.h - database/engine/pdc.c - database/engine/pdc.h - database/engine/page.c - database/engine/page.h - database/engine/page_test.cc - database/engine/page_test.h - database/KolmogorovSmirnovDist.c - database/KolmogorovSmirnovDist.h - ) +set(STREAMING_PLUGIN_FILES + src/streaming/rrdpush.c + src/streaming/rrdpush.h + src/streaming/compression.c + src/streaming/compression.h + src/streaming/compression_brotli.c + src/streaming/compression_brotli.h + src/streaming/compression_gzip.c + src/streaming/compression_gzip.h + src/streaming/compression_lz4.c + src/streaming/compression_lz4.h + src/streaming/compression_zstd.c + src/streaming/compression_zstd.h + src/streaming/receiver.c + src/streaming/sender.c + src/streaming/replication.c + src/streaming/replication.h + src/streaming/common.h +) set(WEB_PLUGIN_FILES - web/server/web_client.c - web/server/web_client.h - web/server/web_server.c - web/server/web_server.h - web/server/static/static-threaded.c - web/server/static/static-threaded.h - web/server/web_client_cache.c - web/server/web_client_cache.h - ) - -set(API_PLUGIN_FILES - web/api/web_api.c - web/api/web_api.h - web/api/web_api_v1.c - web/api/web_api_v1.h - web/api/web_api_v2.c - web/api/web_api_v2.h - web/api/badges/web_buffer_svg.c - web/api/badges/web_buffer_svg.h - web/api/exporters/allmetrics.c - web/api/exporters/allmetrics.h - web/api/exporters/shell/allmetrics_shell.c - web/api/exporters/shell/allmetrics_shell.h - web/api/queries/rrdr.c - web/api/queries/rrdr.h - web/api/queries/query.c - web/api/queries/query.h - web/api/queries/average/average.c - web/api/queries/average/average.h - web/api/queries/countif/countif.c - web/api/queries/countif/countif.h - web/api/queries/incremental_sum/incremental_sum.c - web/api/queries/incremental_sum/incremental_sum.h - web/api/queries/max/max.c - web/api/queries/max/max.h - web/api/queries/min/min.c - web/api/queries/min/min.h - web/api/queries/sum/sum.c - web/api/queries/sum/sum.h - web/api/queries/median/median.c - web/api/queries/median/median.h - web/api/queries/percentile/percentile.c - web/api/queries/percentile/percentile.h - web/api/queries/stddev/stddev.c - web/api/queries/stddev/stddev.h - web/api/queries/ses/ses.c - web/api/queries/ses/ses.h - web/api/queries/des/des.c - web/api/queries/des/des.h - web/api/queries/trimmed_mean/trimmed_mean.c - web/api/queries/trimmed_mean/trimmed_mean.h - web/api/queries/weights.c - web/api/queries/weights.h - web/api/formatters/rrd2json.c - web/api/formatters/rrd2json.h - web/api/formatters/csv/csv.c - web/api/formatters/csv/csv.h - web/api/formatters/json/json.c - web/api/formatters/json/json.h - web/api/formatters/ssv/ssv.c - web/api/formatters/ssv/ssv.h - web/api/formatters/value/value.c - web/api/formatters/value/value.h - web/api/formatters/json_wrapper.c - web/api/formatters/json_wrapper.h - web/api/formatters/charts2json.c - web/api/formatters/charts2json.h - web/api/formatters/rrdset2json.c - web/api/formatters/rrdset2json.h - web/api/health/health_cmdapi.c - web/rtc/webrtc.c - web/rtc/webrtc.h - ) - -set(STREAMING_PLUGIN_FILES - streaming/rrdpush.c - streaming/rrdpush.h - streaming/compression.c - streaming/receiver.c - streaming/sender.c - streaming/replication.c - streaming/replication.h - streaming/common.h - ) + src/web/server/web_client.c + src/web/server/web_client.h + src/web/server/web_server.c + src/web/server/web_server.h + src/web/server/static/static-threaded.c + src/web/server/static/static-threaded.h + src/web/server/web_client_cache.c + src/web/server/web_client_cache.h +) set(CLAIM_PLUGIN_FILES - claim/claim.c - claim/claim.h - ) + src/claim/claim.c + src/claim/claim.h +) -set(ACLK_ALWAYS_BUILD - aclk/aclk_rrdhost_state.h - aclk/aclk_proxy.c - aclk/aclk_proxy.h - aclk/aclk.c - aclk/aclk.h - aclk/aclk_capas.c - aclk/aclk_capas.h - ) +set(SPAWN_PLUGIN_FILES + src/spawn/spawn.c + src/spawn/spawn_server.c + src/spawn/spawn_client.c + src/spawn/spawn.h +) -set(ACLK_FILES - aclk/aclk_util.c - aclk/aclk_util.h - aclk/aclk_stats.c - aclk/aclk_stats.h - aclk/aclk_query.c - aclk/aclk_query.h - aclk/aclk_query_queue.c - aclk/aclk_query_queue.h - aclk/aclk_otp.c - aclk/aclk_otp.h - aclk/aclk_tx_msgs.c - aclk/aclk_tx_msgs.h - aclk/aclk_rx_msgs.c - aclk/aclk_rx_msgs.h - aclk/https_client.c - aclk/https_client.h - aclk/aclk_alarm_api.c - aclk/aclk_alarm_api.h - aclk/aclk_contexts_api.c - aclk/aclk_contexts_api.h - aclk/schema-wrappers/connection.cc - aclk/schema-wrappers/connection.h - aclk/schema-wrappers/node_connection.cc - aclk/schema-wrappers/node_connection.h - aclk/schema-wrappers/node_creation.cc - aclk/schema-wrappers/node_creation.h - aclk/schema-wrappers/alarm_stream.cc - aclk/schema-wrappers/alarm_stream.h - aclk/schema-wrappers/alarm_config.cc - aclk/schema-wrappers/alarm_config.h - aclk/schema-wrappers/node_info.cc - aclk/schema-wrappers/node_info.h - aclk/schema-wrappers/capability.cc - aclk/schema-wrappers/capability.h - aclk/schema-wrappers/proto_2_json.cc - aclk/schema-wrappers/proto_2_json.h - aclk/schema-wrappers/context_stream.cc - aclk/schema-wrappers/context_stream.h - aclk/schema-wrappers/context.cc - aclk/schema-wrappers/context.h - aclk/schema-wrappers/schema_wrappers.h - aclk/schema-wrappers/schema_wrapper_utils.cc - aclk/schema-wrappers/schema_wrapper_utils.h - aclk/schema-wrappers/agent_cmds.cc - aclk/schema-wrappers/agent_cmds.h - aclk/helpers/mqtt_wss_pal.h - aclk/helpers/ringbuffer_pal.h - ) +set(ACLK_ALWAYS_BUILD + src/aclk/aclk_rrdhost_state.h + src/aclk/aclk_proxy.c + src/aclk/aclk_proxy.h + src/aclk/aclk.c + src/aclk/aclk.h + src/aclk/aclk_capas.c + src/aclk/aclk_capas.h + src/aclk/aclk_util.c + src/aclk/aclk_util.h + src/aclk/https_client.c + src/aclk/https_client.h + src/aclk/mqtt_websockets/c-rbuf/cringbuffer.c + src/aclk/mqtt_websockets/c-rbuf/cringbuffer.h + src/aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h + src/aclk/mqtt_websockets/c_rhash/c_rhash.c + src/aclk/mqtt_websockets/c_rhash/c_rhash.h + src/aclk/mqtt_websockets/c_rhash/c_rhash_internal.h +) -set(MQTT_WEBSOCKETS_FILES - mqtt_websockets/src/mqtt_wss_client.c - mqtt_websockets/src/include/mqtt_wss_client.h - mqtt_websockets/src/mqtt_wss_log.c - mqtt_websockets/src/include/mqtt_wss_log.h - mqtt_websockets/src/ws_client.c - mqtt_websockets/src/include/ws_client.h - mqtt_websockets/src/mqtt_ng.c - mqtt_websockets/src/include/mqtt_ng.h - mqtt_websockets/src/common_public.c - mqtt_websockets/src/include/common_public.h - mqtt_websockets/src/include/common_internal.h - mqtt_websockets/c-rbuf/src/ringbuffer.c - mqtt_websockets/c-rbuf/include/ringbuffer.h - mqtt_websockets/c-rbuf/src/ringbuffer_internal.h - ) +set(TIMEX_PLUGIN_FILES + src/collectors/timex.plugin/plugin_timex.c +) -set(SPAWN_PLUGIN_FILES - spawn/spawn.c - spawn/spawn_server.c - spawn/spawn_client.c - spawn/spawn.h - ) +set(PROFILE_PLUGIN_FILES + src/collectors/profile.plugin/plugin_profile.cc +) -set(EXPORTING_ENGINE_FILES - exporting/exporting_engine.c - exporting/exporting_engine.h - exporting/graphite/graphite.c - exporting/graphite/graphite.h - exporting/json/json.c - exporting/json/json.h - exporting/opentsdb/opentsdb.c - exporting/opentsdb/opentsdb.h - exporting/prometheus/prometheus.c - exporting/prometheus/prometheus.h - exporting/read_config.c - exporting/clean_connectors.c - exporting/init_connectors.c - exporting/process_data.c - exporting/check_filters.c - exporting/send_data.c - exporting/send_internal_metrics.c - ) +set(CGROUPS_PLUGIN_FILES + src/collectors/cgroups.plugin/sys_fs_cgroup.c + src/collectors/cgroups.plugin/sys_fs_cgroup.h + src/collectors/cgroups.plugin/cgroup-internals.h + src/collectors/cgroups.plugin/cgroup-discovery.c + src/collectors/cgroups.plugin/cgroup-charts.c + src/collectors/cgroups.plugin/cgroup-top.c +) -set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES - exporting/prometheus/remote_write/remote_write.c - exporting/prometheus/remote_write/remote_write.h - exporting/prometheus/remote_write/remote_write_request.cc - exporting/prometheus/remote_write/remote_write_request.h - ) +set(DISKSPACE_PLUGIN_FILES + src/collectors/diskspace.plugin/plugin_diskspace.c +) -set(KINESIS_EXPORTING_FILES - exporting/aws_kinesis/aws_kinesis.c - exporting/aws_kinesis/aws_kinesis.h - exporting/aws_kinesis/aws_kinesis_put_record.cc - exporting/aws_kinesis/aws_kinesis_put_record.h - ) +set(MACOS_PLUGIN_FILES + src/collectors/macos.plugin/plugin_macos.c + src/collectors/macos.plugin/plugin_macos.h + src/collectors/macos.plugin/macos_sysctl.c + src/collectors/macos.plugin/macos_mach_smi.c + src/collectors/macos.plugin/macos_fw.c +) -set(PUBSUB_EXPORTING_FILES - exporting/pubsub/pubsub.c - exporting/pubsub/pubsub.h - exporting/pubsub/pubsub_publish.cc - exporting/pubsub/pubsub_publish.h - ) +set(FREEBSD_PLUGIN_FILES + src/collectors/freebsd.plugin/plugin_freebsd.c + src/collectors/freebsd.plugin/plugin_freebsd.h + src/collectors/freebsd.plugin/freebsd_sysctl.c + src/collectors/freebsd.plugin/freebsd_getmntinfo.c + src/collectors/freebsd.plugin/freebsd_getifaddrs.c + src/collectors/freebsd.plugin/freebsd_devstat.c + src/collectors/freebsd.plugin/freebsd_kstat_zfs.c + src/collectors/freebsd.plugin/freebsd_ipfw.c + src/collectors/proc.plugin/zfs_common.c + src/collectors/proc.plugin/zfs_common.h +) -set(MONGODB_EXPORTING_FILES - exporting/mongodb/mongodb.c - exporting/mongodb/mongodb.h - ) +set(WINDOWS_PLUGIN_FILES + src/collectors/windows.plugin/windows_plugin.c + src/collectors/windows.plugin/windows_plugin.h + src/collectors/windows.plugin/GetSystemUptime.c + src/collectors/windows.plugin/GetSystemRAM.c + src/collectors/windows.plugin/GetSystemCPU.c + src/collectors/windows.plugin/perflib.c + src/collectors/windows.plugin/perflib.h + src/collectors/windows.plugin/perflib-rrd.c + src/collectors/windows.plugin/perflib-rrd.h + src/collectors/windows.plugin/perflib-names.c + src/collectors/windows.plugin/perflib-dump.c + src/collectors/windows.plugin/perflib-storage.c + src/collectors/windows.plugin/perflib-processor.c + src/collectors/windows.plugin/perflib-network.c + src/collectors/windows.plugin/perflib-memory.c + src/collectors/windows.plugin/perflib-processes.c +) -set(DAEMON_FILES - daemon/buildinfo.c - daemon/buildinfo.h - daemon/common.c - daemon/common.h - daemon/daemon.c - daemon/daemon.h - daemon/event_loop.c - daemon/event_loop.h - daemon/global_statistics.c - daemon/global_statistics.h - daemon/analytics.c - daemon/analytics.h - daemon/main.c - daemon/main.h - daemon/signals.c - daemon/signals.h - daemon/service.c - daemon/static_threads.c - daemon/static_threads.h - daemon/commands.c - daemon/commands.h - daemon/unit_test.c - daemon/unit_test.h - ) +set(PROC_PLUGIN_FILES + src/collectors/proc.plugin/ipc.c + src/collectors/proc.plugin/plugin_proc.c + src/collectors/proc.plugin/plugin_proc.h + src/collectors/proc.plugin/proc_sys_fs_file_nr.c + src/collectors/proc.plugin/proc_diskstats.c + src/collectors/proc.plugin/proc_mdstat.c + src/collectors/proc.plugin/proc_interrupts.c + src/collectors/proc.plugin/proc_softirqs.c + src/collectors/proc.plugin/proc_loadavg.c + src/collectors/proc.plugin/proc_meminfo.c + src/collectors/proc.plugin/proc_pagetypeinfo.c + src/collectors/proc.plugin/proc_net_dev.c + src/collectors/proc.plugin/proc_net_dev_renames.c + src/collectors/proc.plugin/proc_net_dev_renames.h + src/collectors/proc.plugin/proc_net_wireless.c + src/collectors/proc.plugin/proc_net_ip_vs_stats.c + src/collectors/proc.plugin/proc_net_netstat.c + src/collectors/proc.plugin/proc_net_rpc_nfs.c + src/collectors/proc.plugin/proc_net_rpc_nfsd.c + src/collectors/proc.plugin/proc_net_sctp_snmp.c + src/collectors/proc.plugin/proc_net_sockstat.c + src/collectors/proc.plugin/proc_net_sockstat6.c + src/collectors/proc.plugin/proc_net_softnet_stat.c + src/collectors/proc.plugin/proc_net_stat_conntrack.c + src/collectors/proc.plugin/proc_net_stat_synproxy.c + src/collectors/proc.plugin/proc_self_mountinfo.c + src/collectors/proc.plugin/proc_self_mountinfo.h + src/collectors/proc.plugin/zfs_common.c + src/collectors/proc.plugin/zfs_common.h + src/collectors/proc.plugin/proc_spl_kstat_zfs.c + src/collectors/proc.plugin/proc_stat.c + src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c + src/collectors/proc.plugin/proc_vmstat.c + src/collectors/proc.plugin/proc_uptime.c + src/collectors/proc.plugin/proc_pressure.c + src/collectors/proc.plugin/proc_pressure.h + src/collectors/proc.plugin/sys_kernel_mm_ksm.c + src/collectors/proc.plugin/sys_block_zram.c + src/collectors/proc.plugin/sys_devices_system_edac_mc.c + src/collectors/proc.plugin/sys_devices_system_node.c + src/collectors/proc.plugin/sys_class_infiniband.c + src/collectors/proc.plugin/sys_fs_btrfs.c + src/collectors/proc.plugin/sys_class_power_supply.c + src/collectors/proc.plugin/sys_devices_pci_aer.c + src/collectors/proc.plugin/sys_class_drm.c +) -set(ML_FILES - ml/ml.h - ml/ml-dummy.c +set(TC_PLUGIN_FILES + src/collectors/tc.plugin/plugin_tc.c ) -# ----------------------------------------------------------------------------- -# ML - -IF(ENABLE_ML) - message(STATUS "ML: enabled") - list(APPEND ML_FILES - ml/ad_charts.h - ml/ad_charts.cc - ml/Config.cc - ml/dlib/dlib/all/source.cpp - ml/ml.cc - ml/ml-private.h - ) -ELSE() - message(STATUS "ML: disabled") -ENDIF() - -set(LOGSMANAGEMENT_FILES - logsmanagement/rrd_api/rrd_api_docker_ev.c - logsmanagement/rrd_api/rrd_api_docker_ev.h - logsmanagement/rrd_api/rrd_api_generic.c - logsmanagement/rrd_api/rrd_api_generic.h - logsmanagement/rrd_api/rrd_api_kernel.c - logsmanagement/rrd_api/rrd_api_kernel.h - logsmanagement/rrd_api/rrd_api_mqtt.c - logsmanagement/rrd_api/rrd_api_mqtt.h - logsmanagement/rrd_api/rrd_api_stats.c - logsmanagement/rrd_api/rrd_api_stats.h - logsmanagement/rrd_api/rrd_api_systemd.c - logsmanagement/rrd_api/rrd_api_systemd.h - logsmanagement/rrd_api/rrd_api_web_log.c - logsmanagement/rrd_api/rrd_api_web_log.h - logsmanagement/rrd_api/rrd_api.h - logsmanagement/unit_test/unit_test.c - logsmanagement/unit_test/unit_test.h - logsmanagement/circular_buffer.c - logsmanagement/circular_buffer.h - logsmanagement/db_api.c - logsmanagement/db_api.h - logsmanagement/file_info.h - logsmanagement/flb_plugin.c - logsmanagement/flb_plugin.h - logsmanagement/functions.c - logsmanagement/functions.h - logsmanagement/helper.h - logsmanagement/defaults.h - logsmanagement/logsmanag_config.c - logsmanagement/logsmanag_config.h - logsmanagement/logsmanagement.c - logsmanagement/parser.c - logsmanagement/parser.h - logsmanagement/query.c - logsmanagement/query.h - ) +set(LOGS_MANAGEMENT_PLUGIN_FILES + src/logsmanagement/circular_buffer.c + src/logsmanagement/circular_buffer.h + src/logsmanagement/db_api.c + src/logsmanagement/db_api.h + src/logsmanagement/defaults.h + src/logsmanagement/file_info.h + src/logsmanagement/flb_plugin.c + src/logsmanagement/flb_plugin.h + src/logsmanagement/functions.c + src/logsmanagement/functions.h + src/logsmanagement/helper.h + src/logsmanagement/logsmanag_config.c + src/logsmanagement/logsmanag_config.h + src/logsmanagement/logsmanagement.c + src/logsmanagement/parser.c + src/logsmanagement/parser.h + src/logsmanagement/query.c + src/logsmanagement/query.h + src/logsmanagement/rrd_api/rrd_api_docker_ev.c + src/logsmanagement/rrd_api/rrd_api_docker_ev.h + src/logsmanagement/rrd_api/rrd_api_generic.c + src/logsmanagement/rrd_api/rrd_api_generic.h + src/logsmanagement/rrd_api/rrd_api_kernel.c + src/logsmanagement/rrd_api/rrd_api_kernel.h + src/logsmanagement/rrd_api/rrd_api_mqtt.c + src/logsmanagement/rrd_api/rrd_api_mqtt.h + src/logsmanagement/rrd_api/rrd_api_stats.c + src/logsmanagement/rrd_api/rrd_api_stats.h + src/logsmanagement/rrd_api/rrd_api_systemd.c + src/logsmanagement/rrd_api/rrd_api_systemd.h + src/logsmanagement/rrd_api/rrd_api_web_log.c + src/logsmanagement/rrd_api/rrd_api_web_log.h + src/logsmanagement/rrd_api/rrd_api.h + src/database/sqlite/sqlite3.c + src/database/sqlite/sqlite3.h +) set(NETDATA_FILES - collectors/all.h + src/collectors/all.h ${DAEMON_FILES} ${API_PLUGIN_FILES} ${EXPORTING_ENGINE_FILES} @@ -1125,764 +1388,1639 @@ set(NETDATA_FILES ${RRD_PLUGIN_FILES} ${REGISTRY_PLUGIN_FILES} ${STATSD_PLUGIN_FILES} - ${SYSTEMD_JOURNAL_PLUGIN_FILES} ${STREAMING_PLUGIN_FILES} ${WEB_PLUGIN_FILES} ${CLAIM_PLUGIN_FILES} ${SPAWN_PLUGIN_FILES} + ${ACLK_ALWAYS_BUILD} + ${PROFILE_PLUGIN_FILES} ) -set(NETDATACLI_FILES - daemon/commands.h - cli/cli.c - cli/cli.h +if(OS_LINUX) + list(APPEND NETDATA_FILES + src/daemon/static_threads_linux.c + ${CGROUPS_PLUGIN_FILES} + ${DISKSPACE_PLUGIN_FILES} + ${PROC_PLUGIN_FILES} + ${TC_PLUGIN_FILES} + ${TIMEX_PLUGIN_FILES} + ${INTERNAL_COLLECTORS_FILES} + ) + + if(ENABLE_SENTRY) + list(APPEND NETDATA_FILES + src/daemon/sentry-native/sentry-native.c + src/daemon/sentry-native/sentry-native.h) + endif() +elseif(OS_MACOS) + list(APPEND NETDATA_FILES + src/daemon/static_threads_macos.c + ${MACOS_PLUGIN_FILES} + ${TIMEX_PLUGIN_FILES} + ${INTERNAL_COLLECTORS_FILES} + ) +elseif(OS_FREEBSD) + list(APPEND NETDATA_FILES + src/daemon/static_threads_freebsd.c + ${FREEBSD_PLUGIN_FILES} + ${TIMEX_PLUGIN_FILES} + ${INTERNAL_COLLECTORS_FILES} + ) +elseif(OS_WINDOWS) + list(APPEND NETDATA_FILES + src/daemon/static_threads_windows.c + ${WINDOWS_PLUGIN_FILES} + ${INTERNAL_COLLECTORS_FILES} ) +endif() -include_directories(AFTER .) - -add_definitions( - -DHAVE_CONFIG_H - -DCACHE_DIR="/var/cache/netdata" - -DCONFIG_DIR="/etc/netdata" - -DLIBCONFIG_DIR="/usr/lib/netdata/conf.d" - -DLOG_DIR="/var/log/netdata" - -DPLUGINS_DIR="/usr/libexec/netdata/plugins.d" - -DWEB_DIR="/usr/share/netdata/web" - -DVARLIB_DIR="/var/lib/netdata" +set(MQTT_WEBSOCKETS_FILES + src/aclk/mqtt_websockets/mqtt_wss_client.c + src/aclk/mqtt_websockets/mqtt_wss_client.h + src/aclk/mqtt_websockets/mqtt_wss_log.c + src/aclk/mqtt_websockets/mqtt_wss_log.h + src/aclk/mqtt_websockets/ws_client.c + src/aclk/mqtt_websockets/ws_client.h + src/aclk/mqtt_websockets/mqtt_ng.c + src/aclk/mqtt_websockets/mqtt_ng.h + src/aclk/mqtt_websockets/common_public.c + src/aclk/mqtt_websockets/common_public.h + src/aclk/mqtt_websockets/common_internal.h ) -# ----------------------------------------------------------------------------- -# logs management - -IF(ENABLE_LOGSMANAGEMENT) - list(APPEND NETDATA_FILES ${LOGSMANAGEMENT_FILES}) -ENDIF() - -# ----------------------------------------------------------------------------- -# kinesis exporting connector - -IF(KINESIS_LIBRARIES AND AWS_CORE_LIBRARIES AND HAVE_AWS_EVENT_STREAM AND HAVE_AWS_COMMON AND HAVE_AWS_CHECKSUMS AND - CRYPTO_LIBRARIES AND SSL_LIBRARIES AND CURL_LIBRARIES) - SET(ENABLE_EXPORTING_KINESIS True) -ELSE() - SET(ENABLE_EXPORTING_KINESIS False) -ENDIF() - -IF(ENABLE_EXPORTING_KINESIS) - message(STATUS "kinesis exporting: enabled") - list(APPEND NETDATA_FILES ${KINESIS_EXPORTING_FILES}) - list(APPEND NETDATA_COMMON_LIBRARIES ${KINESIS_LIBRARIES} ${AWS_CORE_LIBRARIES} - ${CRYPTO_LIBRARIES} ${SSL_LIBRARIES} ${CURL_LIBRARIES}) - list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${KINESIS_INCLUDE_DIRS} ${AWS_CORE_INCLUDE_DIRS} - ${CRYPTO_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS}) - list(APPEND NETDATA_COMMON_CFLAGS ${CRYPTO_CFLAGS_OTHER} ${SSL_CFLAGS_OTHER} ${CURL_CFLAGS_OTHER}) -ELSE() - message(STATUS "kinesis exporting: disabled (requires AWS SDK for C++)") -ENDIF() - -# ----------------------------------------------------------------------------- -# Pub/Sub exporting connector - -IF(GRPC_LIBRARIES AND PUBSUB_LIBRARIES) - SET(ENABLE_EXPORTING_PUBSUB True) -ELSE() - SET(ENABLE_EXPORTING_PUBSUB False) -ENDIF() - -IF(ENABLE_EXPORTING_PUBSUB) - message(STATUS "pubsub exporting connector: enabled") - list(APPEND NETDATA_FILES ${PUBSUB_EXPORTING_FILES}) - list(APPEND NETDATA_COMMON_LIBRARIES ${GRPC_LIBRARIES} ${PUBSUB_LIBRARIES}) - list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${GRPC_INCLUDE_DIRS} ${PUBSUB_INCLUDE_DIRS}) - list(APPEND NETDATA_COMMON_CFLAGS ${GRPC_CFLAGS_OTHER} ${PUBSUB_CFLAGS_OTHER}) -ELSE() - message(STATUS "pubsub exporting connector: disabled (requires grpc and googleapis)") -ENDIF() - -# ----------------------------------------------------------------------------- -# prometheus remote write exporting connector - -IF(PROTOBUF_LIBRARIES AND SNAPPY_LIBRARIES) - SET(ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE True) -ELSE() - SET(ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE False) -ENDIF() - -IF(ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE) - message(STATUS "prometheus remote write exporting: enabled") - - find_package(Protobuf REQUIRED) - - function(PROTOBUF_REMOTE_WRITE_GENERATE_CPP SRCS HDRS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_REMOTE_WRITE_GENERATE_CPP() called without any proto files") - return() - endif() +set(ACLK_PROTO_DEFS + src/aclk/aclk-schemas/proto/aclk/v1/lib.proto + src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto + src/aclk/aclk-schemas/proto/agent/v1/connection.proto + src/aclk/aclk-schemas/proto/alarm/v1/config.proto + src/aclk/aclk-schemas/proto/alarm/v1/stream.proto + src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto + src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto + src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto + src/aclk/aclk-schemas/proto/context/v1/context.proto + src/aclk/aclk-schemas/proto/context/v1/stream.proto + src/aclk/aclk-schemas/proto/agent/v1/cmds.proto +) - set(${SRCS}) - set(${HDRS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(DIR ${ABS_FIL} DIRECTORY) - get_filename_component(FIL_WE ${FIL} NAME_WE) - set(GENERATED_PB_CC "${DIR}/${FIL_WE}.pb.cc") - set(GENERATED_PB_H "${DIR}/${FIL_WE}.pb.h") - list(APPEND ${SRCS} ${GENERATED_PB_CC}) - list(APPEND ${HDRS} ${GENERATED_PB_H}) - add_custom_command( - OUTPUT ${GENERATED_PB_CC} - ${GENERATED_PB_H} - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS -I=${CMAKE_SOURCE_DIR}/exporting/prometheus/remote_write --cpp_out=${CMAKE_SOURCE_DIR}/exporting/prometheus/remote_write ${ABS_FIL} - DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) - endforeach() - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - set(${SRCS} ${${SRCS}} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} PARENT_SCOPE) - endfunction() - - protobuf_remote_write_generate_cpp(PROTO_SRCS PROTO_HDRS exporting/prometheus/remote_write/remote_write.proto) - - list(APPEND NETDATA_FILES ${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) - list(APPEND NETDATA_COMMON_LIBRARIES ${PROTOBUF_LIBRARIES} ${SNAPPY_LIBRARIES}) - list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} ${SNAPPY_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) - list(APPEND NETDATA_COMMON_CFLAGS ${PROTOBUF_CFLAGS_OTHER} ${SNAPPY_CFLAGS_OTHER}) -ELSE() - message(STATUS "prometheus remote write exporting: disabled (requires protobuf and snappy libraries)") -ENDIF() - -# ----------------------------------------------------------------------------- -# mongodb exporting connector - -IF(MONGOC_LIBRARIES) - message(STATUS "mongodb exporting: enabled") - - list(APPEND NETDATA_FILES ${MONGODB_EXPORTING_FILES}) - list(APPEND NETDATA_COMMON_LIBRARIES ${MONGOC_LIBRARIES}) - list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${MONGOC_INCLUDE_DIRS}) - list(APPEND NETDATA_COMMON_CFLAGS ${MONGOC_CFLAGS_OTHER}) -ELSE() - message(STATUS "mongodb exporting: disabled (requires mongoc library)") -ENDIF() - -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} m ${CMAKE_THREAD_LIBS_INIT}) - -option(ENABLE_ACLK "Enables functionality required to connect to cloud (must be activated by user at run time)" ON) +set(ACLK_FILES + src/aclk/aclk_stats.c + src/aclk/aclk_stats.h + src/aclk/aclk_query.c + src/aclk/aclk_query.h + src/aclk/aclk_query_queue.c + src/aclk/aclk_query_queue.h + src/aclk/aclk_otp.c + src/aclk/aclk_otp.h + src/aclk/aclk_tx_msgs.c + src/aclk/aclk_tx_msgs.h + src/aclk/aclk_rx_msgs.c + src/aclk/aclk_rx_msgs.h + src/aclk/aclk_alarm_api.c + src/aclk/aclk_alarm_api.h + src/aclk/aclk_contexts_api.c + src/aclk/aclk_contexts_api.h + src/aclk/schema-wrappers/connection.cc + src/aclk/schema-wrappers/connection.h + src/aclk/schema-wrappers/node_connection.cc + src/aclk/schema-wrappers/node_connection.h + src/aclk/schema-wrappers/node_creation.cc + src/aclk/schema-wrappers/node_creation.h + src/aclk/schema-wrappers/alarm_stream.cc + src/aclk/schema-wrappers/alarm_stream.h + src/aclk/schema-wrappers/alarm_config.cc + src/aclk/schema-wrappers/alarm_config.h + src/aclk/schema-wrappers/node_info.cc + src/aclk/schema-wrappers/node_info.h + src/aclk/schema-wrappers/capability.cc + src/aclk/schema-wrappers/capability.h + src/aclk/schema-wrappers/proto_2_json.cc + src/aclk/schema-wrappers/proto_2_json.h + src/aclk/schema-wrappers/context_stream.cc + src/aclk/schema-wrappers/context_stream.h + src/aclk/schema-wrappers/context.cc + src/aclk/schema-wrappers/context.h + src/aclk/schema-wrappers/schema_wrappers.h + src/aclk/schema-wrappers/schema_wrapper_utils.cc + src/aclk/schema-wrappers/schema_wrapper_utils.h + src/aclk/schema-wrappers/agent_cmds.cc + src/aclk/schema-wrappers/agent_cmds.h + src/aclk/helpers/mqtt_wss_pal.h + src/aclk/helpers/ringbuffer_pal.h +) -if(ENABLE_ACLK) -find_package(Protobuf REQUIRED) - -function(PROTOBUF_ACLK_GENERATE_CPP SRCS HDRS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_ACLK_GENERATE_CPP() called without any proto files") - return() - endif() - - set(${SRCS}) - set(${HDRS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(DIR ${ABS_FIL} DIRECTORY) - get_filename_component(FIL_WE ${FIL} NAME_WE) - set(GENERATED_PB_CC "${DIR}/${FIL_WE}.pb.cc") - set(GENERATED_PB_H "${DIR}/${FIL_WE}.pb.h") -# cmake > 3.20 required :( -# cmake_path(SET GENERATED_PB_CC "${DIR}") -# cmake_path(SET GENERATED_PB_H "${DIR}") -# cmake_path(APPEND GENERATED_PB_CC "${FIL_WE}.pb.cc") -# cmake_path(APPEND GENERATED_PB_H "${FIL_WE}.pb.h") - - list(APPEND ${SRCS} ${GENERATED_PB_CC}) - list(APPEND ${HDRS} ${GENERATED_PB_H}) - add_custom_command( - OUTPUT ${GENERATED_PB_CC} - ${GENERATED_PB_H} - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS -I=${CMAKE_SOURCE_DIR}/aclk/aclk-schemas --cpp_out=${CMAKE_SOURCE_DIR}/aclk/aclk-schemas ${ABS_FIL} - DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) - endforeach() - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - set(${SRCS} ${${SRCS}} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} PARENT_SCOPE) -endfunction() +set(MONGODB_EXPORTING_FILES + src/exporting/mongodb/mongodb.c + src/exporting/mongodb/mongodb.h +) -set(ACLK_PROTO_DEFS - aclk/aclk-schemas/proto/aclk/v1/lib.proto - aclk/aclk-schemas/proto/agent/v1/disconnect.proto - aclk/aclk-schemas/proto/agent/v1/connection.proto - aclk/aclk-schemas/proto/alarm/v1/config.proto - aclk/aclk-schemas/proto/alarm/v1/stream.proto - aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto - aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto - aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto - aclk/aclk-schemas/proto/context/v1/context.proto - aclk/aclk-schemas/proto/context/v1/stream.proto - aclk/aclk-schemas/proto/agent/v1/cmds.proto +set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES + src/exporting/prometheus/remote_write/remote_write.c + src/exporting/prometheus/remote_write/remote_write.h + src/exporting/prometheus/remote_write/remote_write_request.cc + src/exporting/prometheus/remote_write/remote_write_request.h +) + +# +# build h2o +# + +if(ENABLE_H2O) + add_library(h2o STATIC ${LIBH2O_FILES}) + + target_include_directories(h2o BEFORE PUBLIC + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/cloexec" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/brotli/enc" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/golombset" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libgkc" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libyrmcds" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/klib" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/neverbleed" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picohttpparser" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picotest" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yaml/include" + "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yoml" ) -PROTOBUF_ACLK_GENERATE_CPP(ACLK_PROTO_BUILT_SRCS ACLK_PROTO_BUILT_HDRS ${ACLK_PROTO_DEFS}) - -list(APPEND NETDATA_COMMON_LIBRARIES ${PROTOBUF_LIBRARIES}) -list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS}) -list(APPEND NETDATA_COMMON_CFLAGS ${PROTOBUF_CFLAGS_OTHER}) -list(APPEND NETDATA_FILES ${ACLK_FILES} ${ACLK_PROTO_BUILT_SRCS} ${ACLK_PROTO_BUILT_HDRS}) -include_directories(BEFORE ${CMAKE_SOURCE_DIR}/aclk/aclk-schemas) -include_directories(BEFORE ${CMAKE_SOURCE_DIR}/mqtt_websockets/src/include) -include_directories(BEFORE ${CMAKE_SOURCE_DIR}/mqtt_websockets/c-rbuf/include) - -ADD_LIBRARY(mqttwebsockets STATIC - ${MQTT_WEBSOCKETS_FILES}) - -target_compile_options(mqttwebsockets PUBLIC - -DMQTT_WSS_CUSTOM_ALLOC - -DRBUF_CUSTOM_MALLOC - -DMQTT_WSS_CPUSTATS) - -target_include_directories(mqttwebsockets PUBLIC - ${CMAKE_SOURCE_DIR}/aclk/helpers) - -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} mqttwebsockets) - -ENDIF() - -list(APPEND NETDATA_FILES ${ACLK_ALWAYS_BUILD}) -list(APPEND NETDATA_FILES ${TIMEX_PLUGIN_FILES}) -list(APPEND NETDATA_FILES ${PROFILE_PLUGIN_FILES}) - -# ----------------------------------------------------------------------------- -# netdata - -IF(LINUX) - list(APPEND NETDATA_FILES daemon/static_threads_linux.c) - list(APPEND NETDATA_COMMON_LIBRARIES rt) - - add_executable(netdata ${GENERATED_CONFIG_H} ${NETDATA_FILES} - ${CGROUPS_PLUGIN_FILES} - ${DISKSPACE_PLUGIN_FILES} - ${PROC_PLUGIN_FILES} - ${TC_PLUGIN_FILES} - ) - target_link_libraries (netdata libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(netdata PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(netdata BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(netdata PUBLIC ${NETDATA_COMMON_CFLAGS}) - - SET(ENABLE_PLUGIN_CGROUP_NETWORK True) - SET(ENABLE_PLUGIN_APPS True) - SET(ENABLE_PLUGIN_PERF True) - SET(ENABLE_PLUGIN_SLABINFO True) - -ELSEIF(FREEBSD) - list(APPEND NETDATA_FILES daemon/static_threads_freebsd.c) - - add_executable(netdata ${GENERATED_CONFIG_H} ${NETDATA_FILES} ${FREEBSD_PLUGIN_FILES}) - target_link_libraries (netdata libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(netdata PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(netdata BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(netdata PUBLIC ${NETDATA_COMMON_CFLAGS}) - SET(ENABLE_PLUGIN_CGROUP_NETWORK False) - SET(ENABLE_PLUGIN_APPS True) - SET(ENABLE_PLUGIN_PERF False) - SET(ENABLE_PLUGIN_SLABINFO False) - SET(ENABLE_PLUGIN_EBPF False) - -ELSEIF(MACOS) - list(APPEND NETDATA_FILES daemon/static_threads_macos.c) - - add_executable(netdata ${GENERATED_CONFIG_H} ${NETDATA_FILES} ${MACOS_PLUGIN_FILES}) - target_link_libraries (netdata libnetdata ${NETDATA_COMMON_LIBRARIES} ${IOKIT} ${FOUNDATION}) - target_include_directories(netdata PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(netdata BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(netdata PUBLIC ${NETDATA_COMMON_CFLAGS}) - SET(ENABLE_PLUGIN_CGROUP_NETWORK False) - SET(ENABLE_PLUGIN_APPS False) - SET(ENABLE_PLUGIN_PERF False) - SET(ENABLE_PLUGIN_SLABINFO False) - SET(ENABLE_PLUGIN_EBPF False) - -ENDIF() - -IF(ENABLE_EXPORTING_KINESIS OR ENABLE_EXPORTING_PUBSUB OR ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE) - set_property(TARGET netdata PROPERTY CXX_STANDARD 11) - set_property(TARGET netdata PROPERTY CMAKE_CXX_STANDARD_REQUIRED ON) -ENDIF() - -IF(IPMI_LIBRARIES) - SET(ENABLE_PLUGIN_FREEIPMI True) -ELSE() - SET(ENABLE_PLUGIN_FREEIPMI False) -ENDIF() - -IF(LINUX AND MNL_LIBRARIES AND NFACCT_LIBRARIES) - SET(ENABLE_PLUGIN_NFACCT True) -ELSE() - SET(ENABLE_PLUGIN_NFACCT False) -ENDIF() - -IF(XENSTAT_LIBRARIES) - SET(ENABLE_PLUGIN_XENSTAT True) -ELSE() - SET(ENABLE_PLUGIN_XENSTAT False) -ENDIF() - -IF(CUPS_LIBRARIES) - SET(ENABLE_PLUGIN_CUPS True) -ELSE() - SET(ENABLE_PLUGIN_CUPS False) -ENDIF() - - -# ----------------------------------------------------------------------------- -# netdatacli - -add_executable(netdatacli ${GENERATED_CONFIG_H} ${NETDATACLI_FILES}) -target_link_libraries (netdatacli libnetdata ${NETDATA_COMMON_LIBRARIES}) -target_include_directories(netdatacli PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) -target_include_directories(netdatacli BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) -target_compile_options(netdatacli PUBLIC ${NETDATA_COMMON_CFLAGS}) - - -# ----------------------------------------------------------------------------- -# debugfs.plugin - -IF(ENABLE_PLUGIN_DEBUGFS) - message(STATUS "debugfs.plugin: enabled") - add_executable(debugfs.plugin ${GENERATED_CONFIG_H} ${DEBUGFS_PLUGIN_FILES}) - target_link_libraries (debugfs.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${CAP_LIBRARIES}) - target_include_directories(debugfs.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${CAP_INCLUDE_DIRS}) - target_include_directories(debugfs.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(debugfs.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${CAP_CFLAGS_OTHER}) -ELSE() - message(STATUS "debugfs.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# apps.plugin - -IF(ENABLE_PLUGIN_APPS) - message(STATUS "apps.plugin: enabled") - add_executable(apps.plugin ${GENERATED_CONFIG_H} ${APPS_PLUGIN_FILES}) - target_link_libraries (apps.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${CAP_LIBRARIES}) - target_include_directories(apps.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${CAP_INCLUDE_DIRS}) - target_include_directories(apps.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(apps.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${CAP_CFLAGS_OTHER}) -ELSE() - message(STATUS "apps.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# freeipmi.plugin - -IF(ENABLE_PLUGIN_FREEIPMI) - message(STATUS "freeipmi.plugin: enabled") - add_executable(freeipmi.plugin ${GENERATED_CONFIG_H} ${FREEIPMI_PLUGIN_FILES}) - target_link_libraries (freeipmi.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${IPMI_LIBRARIES}) - target_include_directories(freeipmi.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${IPMI_INCLUDE_DIRS}) - target_include_directories(freeipmi.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(freeipmi.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${IPMI_CFLAGS_OTHER}) -ELSE() - message(STATUS "freeipmi.plugin: disabled (depends on libipmimonitoring)") -ENDIF() - - -# ----------------------------------------------------------------------------- -# nfacct.plugin - -IF(ENABLE_PLUGIN_NFACCT) - message(STATUS "nfacct.plugin: enabled") - add_executable(nfacct.plugin ${GENERATED_CONFIG_H} ${NFACCT_PLUGIN_FILES}) - target_link_libraries (nfacct.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${MNL_LIBRARIES} ${NFACCT_LIBRARIES}) - target_include_directories(nfacct.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS}) - target_include_directories(nfacct.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(nfacct.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER}) -ELSE() - message(STATUS "nfacct.plugin: disabled (requires libmnl and libnetfilter_acct)") -ENDIF() - - -# ----------------------------------------------------------------------------- -# xenstat.plugin - -IF(ENABLE_PLUGIN_XENSTAT) - message(STATUS "xenstat.plugin: enabled") - add_executable(xenstat.plugin ${GENERATED_CONFIG_H} ${XENSTAT_PLUGIN_FILES}) - target_link_libraries (xenstat.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${XENSTAT_LIBRARIES}) - target_include_directories(xenstat.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS}) - target_include_directories(xenstat.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(xenstat.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${XENSTAT_CFLAGS_OTHER}) -ELSE() - message(STATUS "xenstat.plugin: disabled (requires libxenstat)") -ENDIF() - - -# ----------------------------------------------------------------------------- -# perf.plugin - -IF(ENABLE_PLUGIN_PERF) - message(STATUS "perf.plugin: enabled") - add_executable(perf.plugin ${GENERATED_CONFIG_H} ${PERF_PLUGIN_FILES}) - target_link_libraries (perf.plugin libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(perf.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(perf.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(perf.plugin PUBLIC ${NETDATA_COMMON_CFLAGS}) -ELSE() - message(STATUS "perf.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# ebpf_process.plugin - -IF(ENABLE_PLUGIN_EBPF) - message(STATUS "ebpf.plugin: enabled") - add_executable(ebpf.plugin ${GENERATED_CONFIG_H} ${EBPF_PROCESS_PLUGIN_FILES}) - target_link_libraries (ebpf.plugin libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(ebpf.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(ebpf.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(ebpf.plugin PUBLIC ${NETDATA_COMMON_CFLAGS}) -ELSE() - message(STATUS "ebpf.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# slabinfo.plugin - -IF(ENABLE_PLUGIN_SLABINFO) - message(STATUS "slabinfo.plugin: enabled") - add_executable(slabinfo.plugin ${GENERATED_CONFIG_H} ${SLABINFO_PLUGIN_FILES}) - target_link_libraries (slabinfo.plugin libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(slabinfo.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(slabinfo.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(slabinfo.plugin PUBLIC ${NETDATA_COMMON_CFLAGS}) -ELSE() - message(STATUS "slabinfo.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# cups.plugin - -IF(ENABLE_PLUGIN_CUPS) - message(STATUS "cups.plugin: enabled") - add_executable(cups.plugin ${GENERATED_CONFIG_H} ${CUPS_PLUGIN_FILES}) - target_link_libraries (cups.plugin libnetdata ${NETDATA_COMMON_LIBRARIES} ${CUPS_LIBRARIES}) - target_include_directories(cups.plugin PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS} ${CUPS_INCLUDE_DIRS}) - target_include_directories(cups.plugin BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(cups.plugin PUBLIC ${NETDATA_COMMON_CFLAGS} ${CUPS_CFLAGS_OTHER}) -ELSE() - message(STATUS "cups.plugin: disabled") -ENDIF() - - -# ----------------------------------------------------------------------------- -# cgroup-network - -IF(ENABLE_PLUGIN_CGROUP_NETWORK) - message(STATUS "cgroup-network: enabled") - add_executable(cgroup-network ${GENERATED_CONFIG_H} ${CGROUP_NETWORK_FILES}) - target_link_libraries (cgroup-network libnetdata ${NETDATA_COMMON_LIBRARIES}) - target_include_directories(cgroup-network PUBLIC ${NETDATA_COMMON_INCLUDE_DIRS}) - target_include_directories(cgroup-network BEFORE PUBLIC ${GENERATED_CONFIG_H_DIR}) - target_compile_options(cgroup-network PUBLIC ${NETDATA_COMMON_CFLAGS}) -ELSE() - message(STATUS "cgroup-network: disabled (requires Linux)") -ENDIF() - -# ----------------------------------------------------------------------------- -# Unit tests - -if(UNIT_TESTING) - message(STATUS "Looking for CMocka which is required for unit testing") - find_package(CMocka REQUIRED) - include(CTest) - -if(BUILD_TESTING) - add_executable(str2ld_testdriver libnetdata/tests/test_str2ld.c) - target_link_libraries(str2ld_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) - add_test(NAME test_str2ld COMMAND str2ld_testdriver) - - add_executable(storage_number_testdriver libnetdata/storage_number/tests/test_storage_number.c) - target_link_libraries(storage_number_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) - add_test(NAME test_storage_number COMMAND storage_number_testdriver) - - set(EXPORTING_ENGINE_TEST_FILES - exporting/tests/test_exporting_engine.c - exporting/tests/test_exporting_engine.h - exporting/tests/exporting_fixtures.c - exporting/tests/exporting_doubles.c - exporting/tests/netdata_doubles.c - exporting/tests/system_doubles.c - database/rrdlabels.c - database/rrdvar.c + + target_compile_options(h2o PRIVATE + -Wno-all -Wno-extra + -Wno-shadow + -Wno-deprecated-declarations + -Wformat ) - set(TEST_NAME exporting_engine) - set(PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS) - set(KINESIS_LINK_OPTIONS) - set(PUBSUB_LINK_OPTIONS) - set(MONGODB_LINK_OPTIONS) -if(ENABLE_EXPORTING_PROMETHEUS_REMOTE_WRITE) - list(APPEND EXPORTING_ENGINE_FILES ${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) - list( - APPEND PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS - -Wl,--wrap=init_write_request - -Wl,--wrap=add_host_info - -Wl,--wrap=add_label - -Wl,--wrap=add_metric - ) + + target_compile_options(h2o PUBLIC -DH2O_USE_LIBUV=0) + target_link_libraries(h2o PRIVATE PkgConfig::TLS) endif() -if(ENABLE_EXPORTING_KINESIS) - list(APPEND EXPORTING_ENGINE_FILES ${KINESIS_EXPORTING_FILES}) - list( - APPEND KINESIS_LINK_OPTIONS - -Wl,--wrap=aws_sdk_init - -Wl,--wrap=kinesis_init - -Wl,--wrap=kinesis_put_record - -Wl,--wrap=kinesis_get_result - ) + +# +# build libjudy +# + +add_library(judy STATIC ${LIBJUDY_SOURCES}) + +target_compile_options(judy PRIVATE + -Wno-all -Wno-extra + -Wno-shadow + -Wformat +) + +target_compile_definitions(judy PRIVATE + JUDYL + $<$:JU_64BIT> +) + +target_include_directories(judy PUBLIC + src/libnetdata/libjudy/src + src/libnetdata/libjudy/src/JudyCommon +) + +set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV") +set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT") +set_source_files_properties(src/libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE") +set_source_files_properties(src/libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB") +set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL") + +# +# build libnetdata +# + +if(OS_LINUX) + include(NetdataDetectSystemd) + detect_systemd() endif() -if(ENABLE_EXPORTING_PUBSUB) - list(APPEND EXPORTING_ENGINE_FILES ${PUBSUB_EXPORTING_FILES}) - list( - APPEND PUBSUB_LINK_OPTIONS - -Wl,--wrap=pubsub_init - -Wl,--wrap=pubsub_add_message - -Wl,--wrap=pubsub_publish - -Wl,--wrap=pubsub_get_result - ) + +add_library(libnetdata STATIC ${LIBNETDATA_FILES}) + +target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src) + +# pthread (FIXME: use find_package for this) + +# set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +# set(THREADS_PREFER_PTHREAD_FLAG TRUE) +# find_package(Threads REQUIRED) + +# add_executable(test test.cpp) +# target_link_libraries(test Threads::Threads) + +target_link_libraries(libnetdata PUBLIC + "$<$>:atomic>" + "$<$,$>:pthread;rt>" + "$<$:kernel32;advapi32;winmm;rpcrt4>" + "$<$:m>" + "${SYSTEMD_LDFLAGS}") + +# ebpf +if(ENABLE_PLUGIN_EBPF) + netdata_add_libbpf_to_target(libnetdata) endif() -if(MONGOC_LIBRARIES) - list(APPEND EXPORTING_ENGINE_FILES ${MONGODB_EXPORTING_FILES}) - list( - APPEND MONGODB_LINK_OPTIONS - -Wl,--wrap=mongoc_init - -Wl,--wrap=mongoc_uri_new_with_error - -Wl,--wrap=mongoc_uri_get_option_as_int32 - -Wl,--wrap=mongoc_uri_set_option_as_int32 - -Wl,--wrap=mongoc_client_new_from_uri - -Wl,--wrap=mongoc_client_set_appname - -Wl,--wrap=mongoc_client_get_collection - -Wl,--wrap=mongoc_uri_destroy - -Wl,--wrap=mongoc_collection_insert_many - ) + +# judy +target_link_libraries(libnetdata PUBLIC judy) + +netdata_add_jsonc_to_target(libnetdata) + +netdata_add_libyaml_to_target(libnetdata) + +# zlib +if(OS_MACOS) + find_package(ZLIB REQUIRED) + target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(libnetdata PUBLIC ZLIB::ZLIB) +else() + pkg_check_modules(ZLIB REQUIRED zlib) + target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS}) + target_compile_options(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER}) + target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS}) endif() - add_executable(${TEST_NAME}_testdriver ${EXPORTING_ENGINE_TEST_FILES} ${EXPORTING_ENGINE_FILES}) - target_compile_options( - ${TEST_NAME}_testdriver - PRIVATE - -DUNIT_TESTING - ) - target_include_directories( - ${TEST_NAME}_testdriver - PUBLIC - ${CMAKE_CURRENT_BINARY_DIR} - ${NETDATA_COMMON_INCLUDE_DIRS} + +# lz4 - try to find a version that is compatible with streaming compression +# otherwise pick whichever one we can find to support dbengine but don't set +# ENABLE_LZ4. +pkg_check_modules(LIBLZ4 liblz4>=1.9.0) +if(LIBLZ4_FOUND) + set(ENABLE_LZ4 On) +else() + pkg_check_modules(LIBLZ4 REQUIRED liblz4) +endif() + +target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS}) +target_compile_options(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER}) +target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS}) + +# zstd +pkg_check_modules(LIBZSTD libzstd) +if(LIBZSTD_FOUND) + set(ENABLE_ZSTD On) + target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS}) + target_compile_options(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER}) + target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS}) +endif() + +# brotli +pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon) +if(LIBBROTLI_FOUND) + set(ENABLE_BROTLI On) + target_include_directories(libnetdata PUBLIC ${LIBBROTLI_INCLUDE_DIRS}) + target_compile_options(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER}) + target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS}) +endif() + +# uuid +if(OS_MACOS OR OS_WINDOWS) + # UUID functionality is part of the system libraries here, so no extra + # stuff needed. +else() + pkg_check_modules(UUID REQUIRED uuid) + target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS}) + target_compile_options(libnetdata PUBLIC ${UUID_CFLAGS_OTHER}) + target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS}) +endif() + +# uv +pkg_check_modules(LIBUV REQUIRED libuv) +target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS}) +target_compile_options(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER}) +target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS}) + +# crypto +target_link_libraries(libnetdata PUBLIC PkgConfig::CRYPTO) + +# openssl +target_link_libraries(libnetdata PUBLIC PkgConfig::TLS) + +# mnl +if(NOT OS_MACOS) + pkg_check_modules(MNL libmnl) + if(MNL_FOUND) + set(HAVE_LIBMNL True) + endif() +endif() + +# +# mqtt library +# +if (ENABLE_H2O OR ENABLE_ACLK) + set(ENABLE_MQTTWEBSOCKETS True) +endif() + +if(ENABLE_MQTTWEBSOCKETS) + add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES}) + + target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC + -DRBUF_CUSTOM_MALLOC + -DMQTT_WSS_CPUSTATS) + + target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers + ${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include) + + target_link_libraries(mqttwebsockets PRIVATE libnetdata) + +endif() + +if(ENABLE_ACLK) + # + # proto definitions + # + netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" + "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" + ACLK_PROTO_BUILT_SRCS + ACLK_PROTO_BUILT_HDRS + ${ACLK_PROTO_DEFS}) + + list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS} + ${ACLK_PROTO_BUILT_HDRS}) + +endif() + +# +# build plugins +# + +if(ENABLE_PLUGIN_DEBUGFS) + pkg_check_modules(CAP QUIET libcap) + + set(DEBUGFS_PLUGIN_FILES src/collectors/debugfs.plugin/debugfs_plugin.c + src/collectors/debugfs.plugin/debugfs_plugin.h + src/collectors/debugfs.plugin/debugfs_extfrag.c + src/collectors/debugfs.plugin/debugfs_zswap.c + src/collectors/debugfs.plugin/sys_devices_virtual_powercap.c) + + add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES}) + target_link_libraries(debugfs.plugin libnetdata ${CAP_LIBRARIES}) + target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS}) + target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER}) + + install(TARGETS debugfs.plugin + COMPONENT plugin-debugfs + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-debugfs + DESTINATION usr/share/doc/netdata-plugin-debugfs) + endif() +endif() + +if(ENABLE_PLUGIN_APPS) + pkg_check_modules(CAP QUIET libcap) + + set(APPS_PLUGIN_FILES + src/collectors/apps.plugin/apps_plugin.c + src/collectors/apps.plugin/apps_plugin.h + src/collectors/apps.plugin/apps_functions.c + src/collectors/apps.plugin/apps_targets.c + src/collectors/apps.plugin/apps_users_and_groups.c + src/collectors/apps.plugin/apps_output.c + src/collectors/apps.plugin/apps_proc_pid_status.c + src/collectors/apps.plugin/apps_proc_pid_limits.c + src/collectors/apps.plugin/apps_proc_pid_stat.c + src/collectors/apps.plugin/apps_proc_pid_cmdline.c + src/collectors/apps.plugin/apps_proc_pid_io.c + src/collectors/apps.plugin/apps_proc_stat.c + src/collectors/apps.plugin/apps_proc_pid_fd.c + src/collectors/apps.plugin/apps_proc_pids.c + src/collectors/apps.plugin/apps_proc_meminfo.c ) - target_link_options( - ${TEST_NAME}_testdriver - PRIVATE - -Wl,--wrap=read_exporting_config - -Wl,--wrap=init_connectors - -Wl,--wrap=mark_scheduled_instances - -Wl,--wrap=rrdhost_is_exportable - -Wl,--wrap=rrdset_is_exportable - -Wl,--wrap=exporting_calculate_value_from_stored_data - -Wl,--wrap=prepare_buffers - -Wl,--wrap=send_internal_metrics - -Wl,--wrap=now_realtime_sec - -Wl,--wrap=uv_thread_set_name_np - -Wl,--wrap=uv_thread_create - -Wl,--wrap=uv_mutex_lock - -Wl,--wrap=uv_mutex_unlock - -Wl,--wrap=uv_cond_signal - -Wl,--wrap=uv_cond_wait - -Wl,--wrap=strdupz - -Wl,--wrap=info_int - -Wl,--wrap=recv - -Wl,--wrap=send - -Wl,--wrap=connect_to_one_of - -Wl,--wrap=create_main_rusage_chart - -Wl,--wrap=send_main_rusage - -Wl,--wrap=simple_connector_end_batch - ${PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS} - ${KINESIS_LINK_OPTIONS} - ${PUBSUB_LINK_OPTIONS} - ${MONGODB_LINK_OPTIONS} + + add_executable(apps.plugin ${APPS_PLUGIN_FILES}) + target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES}) + target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS}) + target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER}) + + install(TARGETS apps.plugin + COMPONENT plugin-apps + DESTINATION usr/libexec/netdata/plugins.d) + + install(FILES src/collectors/apps.plugin/apps_groups.conf + COMPONENT plugin-apps + DESTINATION usr/lib/netdata/conf.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-apps + DESTINATION usr/share/doc/netdata-plugin-apps) + endif() +endif() + +if(CAP_FOUND) + set(HAVE_CAPABILITY True) +endif() + +if(ENABLE_PLUGIN_FREEIPMI) + pkg_check_modules(IPMI REQUIRED libipmimonitoring) + + set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c) + + add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES}) + target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES}) + target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS}) + target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER}) + + install(TARGETS freeipmi.plugin + COMPONENT plugin-freeipmi + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-freeipmi + DESTINATION usr/share/doc/netdata-plugin-freeipmi) + endif() +endif() + +if(ENABLE_PLUGIN_NFACCT) + if (NOT MNL_FOUND) + message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.") + endif() + + pkg_check_modules(NFACCT REQUIRED libnetfilter_acct) + + set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c) + + add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES}) + target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES}) + target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS}) + target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER}) + + install(TARGETS nfacct.plugin + COMPONENT plugin-nfacct + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-nfacct + DESTINATION usr/share/doc/netdata-plugin-nfacct) + endif() +endif() + +if(ENABLE_PLUGIN_XENSTAT) + pkg_check_modules(XENSTAT REQUIRED xenstat) + pkg_check_modules(XENLIGHT REQUIRED xenlight) + + set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c) + + add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES}) + target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES}) + target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS}) + target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER}) + + install(TARGETS xenstat.plugin + COMPONENT plugin-xenstat + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-xenstat + DESTINATION usr/share/doc/netdata-plugin-xenstat) + endif() +endif() + +if(ENABLE_PLUGIN_PERF) + set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c) + + add_executable(perf.plugin ${PERF_PLUGIN_FILES}) + target_link_libraries(perf.plugin libnetdata) + + install(TARGETS perf.plugin + COMPONENT plugin-perf + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-perf + DESTINATION usr/share/doc/netdata-plugin-perf) + endif() +endif() + +if(ENABLE_PLUGIN_SLABINFO) + set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c) + + add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES}) + target_link_libraries(slabinfo.plugin libnetdata) + + install(TARGETS slabinfo.plugin + COMPONENT plugin-slabinfo + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-slabinfo + DESTINATION usr/share/doc/netdata-plugin-slabinfo) + endif() +endif() + +if(ENABLE_PLUGIN_LOGS_MANAGEMENT) + set(ENABLE_LOGSMANAGEMENT True) + + if(ENABLE_LOGS_MANAGEMENT_TESTS) + list(APPEND LOGS_MANAGEMENT_PLUGIN_FILES src/logsmanagement/unit_test/unit_test.c + src/logsmanagement/unit_test/unit_test.h) + set(ENABLE_LOGSMANAGEMENT_TESTS True) + endif() + + add_executable(logs-management.plugin ${LOGS_MANAGEMENT_PLUGIN_FILES}) + target_link_libraries(logs-management.plugin libnetdata) + + install(TARGETS logs-management.plugin + COMPONENT plugin-logs-management + DESTINATION usr/libexec/netdata/plugins.d) + + install(DIRECTORY src/logsmanagement/stock_conf/logsmanagement.d + COMPONENT plugin-logs-management + DESTINATION usr/lib/netdata/conf.d) + + install(DIRECTORY + COMPONENT plugin-logs-management + DESTINATION etc/netdata/logsmanagement.d) + + configure_file(src/logsmanagement/stock_conf/logsmanagement.d.conf.in + src/logsmanagement/stock_conf/logsmanagement.d.conf + @ONLY) + + install(FILES ${CMAKE_BINARY_DIR}/src/logsmanagement/stock_conf/logsmanagement.d.conf + COMPONENT plugin-logs-management + DESTINATION usr/lib/netdata/conf.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-logs-management + DESTINATION usr/share/doc/netdata-plugin-logs-management) + endif() +endif() + +if(ENABLE_PLUGIN_CUPS) + pkg_check_modules(CUPS libcups) + if(NOT CUPS_FOUND) + pkg_check_modules(CUPS cups) + if(NOT CUPS_FOUND) + find_program(CUPS_CONFIG cups-config) + if(CUPS_CONFIG) + execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + if(CUPS_API_VERSION VERSION_LESS "1.7") + set(CUPS_FOUND False) + else() + execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CUPS_FOUND True) + endif() + endif() + endif() + endif() + + if(NOT CUPS_FOUND) + message(WARNING "Could not find cups cflags and libs.") + else() + set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c) + add_executable(cups.plugin ${CUPS_PLUGIN_FILES}) + target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES}) + target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER}) + + install(TARGETS cups.plugin + COMPONENT plugin-cups + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-cups + DESTINATION usr/share/doc/netdata-plugin-cups) + endif() + endif() +endif() + +set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c) + +add_executable(ndsudo ${NDSUDO_FILES}) + +install(TARGETS ndsudo + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +if(ENABLE_PLUGIN_CGROUP_NETWORK) + set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c) + + add_executable(cgroup-network ${CGROUP_NETWORK_FILES}) + target_link_libraries(cgroup-network libnetdata) + + install(TARGETS cgroup-network + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) +endif() + +if(ENABLE_PLUGIN_SYSTEMD_JOURNAL) + if(NOT SYSTEMD_FOUND) + message(FATAL_ERROR "Systemd journal plugin requires systemd, but systemd was not found.") + endif() + + add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES}) + target_link_libraries(systemd-journal.plugin libnetdata) + + install(TARGETS systemd-journal.plugin + COMPONENT plugin-systemd-journal + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-systemd-journal + DESTINATION usr/share/doc/netdata-plugin-systemd-journal) + endif() +endif() + +if(ENABLE_PLUGIN_EBPF) + set(EBPF_PLUGIN_FILES + src/collectors/ebpf.plugin/ebpf.c + src/collectors/ebpf.plugin/ebpf.h + src/collectors/ebpf.plugin/ebpf_cachestat.c + src/collectors/ebpf.plugin/ebpf_cachestat.h + src/collectors/ebpf.plugin/ebpf_dcstat.c + src/collectors/ebpf.plugin/ebpf_dcstat.h + src/collectors/ebpf.plugin/ebpf_disk.c + src/collectors/ebpf.plugin/ebpf_disk.h + src/collectors/ebpf.plugin/ebpf_fd.c + src/collectors/ebpf.plugin/ebpf_fd.h + src/collectors/ebpf.plugin/ebpf_hardirq.c + src/collectors/ebpf.plugin/ebpf_hardirq.h + src/collectors/ebpf.plugin/ebpf_mdflush.c + src/collectors/ebpf.plugin/ebpf_mdflush.h + src/collectors/ebpf.plugin/ebpf_mount.c + src/collectors/ebpf.plugin/ebpf_mount.h + src/collectors/ebpf.plugin/ebpf_filesystem.c + src/collectors/ebpf.plugin/ebpf_filesystem.h + src/collectors/ebpf.plugin/ebpf_oomkill.c + src/collectors/ebpf.plugin/ebpf_oomkill.h + src/collectors/ebpf.plugin/ebpf_process.c + src/collectors/ebpf.plugin/ebpf_process.h + src/collectors/ebpf.plugin/ebpf_shm.c + src/collectors/ebpf.plugin/ebpf_shm.h + src/collectors/ebpf.plugin/ebpf_socket.c + src/collectors/ebpf.plugin/ebpf_socket.h + src/collectors/ebpf.plugin/ebpf_softirq.c + src/collectors/ebpf.plugin/ebpf_softirq.h + src/collectors/ebpf.plugin/ebpf_sync.c + src/collectors/ebpf.plugin/ebpf_sync.h + src/collectors/ebpf.plugin/ebpf_swap.c + src/collectors/ebpf.plugin/ebpf_swap.h + src/collectors/ebpf.plugin/ebpf_vfs.c + src/collectors/ebpf.plugin/ebpf_vfs.h + src/collectors/ebpf.plugin/ebpf_apps.c + src/collectors/ebpf.plugin/ebpf_apps.h + src/collectors/ebpf.plugin/ebpf_cgroup.c + src/collectors/ebpf.plugin/ebpf_cgroup.h + src/collectors/ebpf.plugin/ebpf_unittest.c + src/collectors/ebpf.plugin/ebpf_unittest.h + src/collectors/ebpf.plugin/ebpf_functions.c + src/collectors/ebpf.plugin/ebpf_functions.h ) - target_link_libraries(${TEST_NAME}_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) - add_test(NAME test_${TEST_NAME} COMMAND ${TEST_NAME}_testdriver) - set(WEB_API_TEST_FILES - web/api/tests/web_api.c - web/server/web_client.c + add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES}) + target_link_libraries(ebpf.plugin libnetdata) + + netdata_add_ebpf_co_re_to_target(ebpf.plugin) + + install(TARGETS ebpf.plugin + COMPONENT plugin-ebpf + DESTINATION usr/libexec/netdata/plugins.d) + + install(FILES + src/collectors/ebpf.plugin/ebpf.d.conf + COMPONENT plugin-ebpf + DESTINATION usr/lib/netdata/conf.d) + + install(FILES + src/collectors/ebpf.plugin/ebpf.d/cachestat.conf + src/collectors/ebpf.plugin/ebpf.d/dcstat.conf + src/collectors/ebpf.plugin/ebpf.d/disk.conf + src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt + src/collectors/ebpf.plugin/ebpf.d/fd.conf + src/collectors/ebpf.plugin/ebpf.d/filesystem.conf + src/collectors/ebpf.plugin/ebpf.d/hardirq.conf + src/collectors/ebpf.plugin/ebpf.d/mdflush.conf + src/collectors/ebpf.plugin/ebpf.d/mount.conf + src/collectors/ebpf.plugin/ebpf.d/network.conf + src/collectors/ebpf.plugin/ebpf.d/oomkill.conf + src/collectors/ebpf.plugin/ebpf.d/process.conf + src/collectors/ebpf.plugin/ebpf.d/shm.conf + src/collectors/ebpf.plugin/ebpf.d/softirq.conf + src/collectors/ebpf.plugin/ebpf.d/swap.conf + src/collectors/ebpf.plugin/ebpf.d/sync.conf + src/collectors/ebpf.plugin/ebpf.d/vfs.conf + COMPONENT plugin-ebpf + DESTINATION usr/lib/netdata/conf.d/ebpf.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-ebpf + DESTINATION usr/share/doc/netdata-plugin-ebpf) + endif() + + if(ENABLE_LEGACY_EBPF_PROGRAMS) + netdata_install_legacy_ebpf_code() + endif() +endif() + +if(ENABLE_PLUGIN_LOCAL_LISTENERS) + set(LOCAL_LISTENERS_FILES + src/collectors/plugins.d/local_listeners.c + src/libnetdata/maps/local-sockets.h ) - add_executable(web_api_testdriver ${WEB_API_TEST_FILES}) - target_link_options( - web_api_testdriver - PRIVATE - -Wl,--wrap=rrdhost_find_by_hostname - -Wl,--wrap=finished_web_request_statistics - -Wl,--wrap=config_get - -Wl,--wrap=web_client_api_request_v1 - -Wl,--wrap=rrdhost_find_by_guid - -Wl,--wrap=rrdset_find_byname - -Wl,--wrap=sql_create_host_by_uuid - -Wl,--wrap=rrdset_find - -Wl,--wrap=rrdpush_receiver_thread_spawn - -Wl,--wrap=debug_int - -Wl,--wrap=error_int - -Wl,--wrap=info_int - -Wl,--wrap=fatal_int - ) - target_link_libraries(web_api_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) -# add_test(NAME test_web_api COMMAND web_api_testdriver) - set(VALID_URLS_TEST_FILES - web/api/tests/valid_urls.c - web/server/web_client.c + add_executable(local-listeners ${LOCAL_LISTENERS_FILES}) + + target_compile_options(local-listeners PRIVATE + "$<$:${MNL_CFLAGS_OTHER}>") + target_include_directories(local-listeners PRIVATE + "$<$:${MNL_INCLUDE_DIRS}>") + target_link_libraries(local-listeners libnetdata + "$<$:${MNL_LIBRARIES}>") + + install(TARGETS local-listeners + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) +endif() + +if(ENABLE_PLUGIN_NETWORK_VIEWER) + set(NETWORK_VIEWER_FILES + src/libnetdata/maps/local-sockets.h + src/libnetdata/maps/system-users.h + src/collectors/network-viewer.plugin/network-viewer.c ) - add_executable(valid_urls_testdriver ${VALID_URLS_TEST_FILES}) - target_link_options( - valid_urls_testdriver - PRIVATE - -Wl,--wrap=rrdhost_find_by_hostname - -Wl,--wrap=finished_web_request_statistics - -Wl,--wrap=config_get - -Wl,--wrap=web_client_api_request_v1 - -Wl,--wrap=rrdhost_find_by_guid - -Wl,--wrap=rrdset_find_byname - -Wl,--wrap=sql_create_host_by_uuid - -Wl,--wrap=rrdset_find - -Wl,--wrap=rrdpush_receiver_thread_spawn - -Wl,--wrap=debug_int - -Wl,--wrap=error_int - -Wl,--wrap=info_int - -Wl,--wrap=fatal_int - -Wl,--wrap=mysendfile - -DREMOVE_MYSENDFILE - ) - target_link_libraries(valid_urls_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) -# add_test(NAME test_valid_urls COMMAND valid_urls_testdriver) - - set(CGROUPS_TEST_FILES - collectors/cgroups.plugin/tests/test_cgroups_plugin.c - collectors/cgroups.plugin/tests/test_cgroups_plugin.h - collectors/cgroups.plugin/tests/test_doubles.c - database/rrdlabels.c - database/rrd.h - ) - add_executable(cgroups_testdriver ${CGROUPS_TEST_FILES} ${CGROUPS_PLUGIN_FILES}) - target_link_libraries(cgroups_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) - add_test(NAME test_cgroups COMMAND cgroups_testdriver) - - set_target_properties( - str2ld_testdriver - storage_number_testdriver - exporting_engine_testdriver - web_api_testdriver - valid_urls_testdriver - cgroups_testdriver - PROPERTIES RUNTIME_OUTPUT_DIRECTORY tests - ) + add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES}) + + target_compile_options(network-viewer.plugin PRIVATE + "$<$:${MNL_CFLAGS_OTHER}>") + target_include_directories(network-viewer.plugin PRIVATE + "$<$:${MNL_INCLUDE_DIRS}>") + target_link_libraries(network-viewer.plugin libnetdata + "$<$:${MNL_LIBRARIES}>") + + install(TARGETS network-viewer.plugin + COMPONENT plugin-network-viewer + DESTINATION usr/libexec/netdata/plugins.d) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-network-viewer + DESTINATION usr/share/doc/netdata-plugin-network-viewer) + endif() +endif() + +# +# exporters +# + +if(ENABLE_EXPORTER_MONGODB) + pkg_check_modules(MONGOC libmongoc-1.0>=1.7) + + if(MONGOC_FOUND) + SET(HAVE_MONGOC True) + else() + SET(ENABLE_EXPORTER_MONGODB False) + endif() +endif() + +if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE) + pkg_check_modules(SNAPPY snappy) + if (NOT SNAPPY_FOUND) + include(CheckLibraryExists) + check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB) + + if(HAVE_SNAPPY_LIB) + set(SNAPPY_INCLUDE_DIRS "") + set(SNAPPY_CFLAGS_OTHER "") + set(SNAPPY_LIBRARIES "-lsnappy") + else() + message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.") + endif() + endif() + + netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write" + "${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write" + PROMETHEUS_REMOTE_WRITE_BUILT_SRCS + PROMETHEUS_REMOTE_WRITE_BUILT_HDRS + "src/exporting/prometheus/remote_write/remote_write.proto") + + list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES + ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS} + ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS}) + + set(ENABLE_PROMETHEUS_REMOTE_WRITE True) +endif() + +# +# build netdata (only Linux ATM) +# + +add_executable(netdata + ${NETDATA_FILES} + "$<$:${ACLK_FILES}>" + "$<$:${H2O_FILES}>" + "$<$:${MONGODB_EXPORTING_FILES}>" + "$<$:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>" +) + +target_compile_definitions(netdata PRIVATE + "$<$:DLIB_NO_GUI_SUPPORT>" +) + +target_compile_options(netdata PRIVATE + "$<$:${MONGOC_CFLAGS_OTHER}>" + "$<$:${SNAPPY_CFLAGS_OTHER}>" +) + +target_include_directories(netdata PRIVATE + "$<$:${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas>" + "$<$:${MONGOC_INCLUDE_DIRS}>" + "$<$:${SNAPPY_INCLUDE_DIRS}>" +) + +target_link_libraries(netdata PRIVATE + m + libnetdata + "$<$:rt>" + "$<$:mqttwebsockets>" + "$<$:${MONGOC_LIBRARIES}>" + "$<$:${SNAPPY_LIBRARIES}>" + "$<$:${IOKIT};${FOUNDATION}>" + "$<$:sentry>" + "$<$:LibDataChannel::LibDataChannelStatic>" + "$<$:h2o>" +) + +if(NEED_PROTOBUF) + netdata_add_protobuf(netdata) endif() + +# +# build systemd-cat-native +# +set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c + src/libnetdata/log/systemd-cat-native.h) + +add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES}) +target_link_libraries(systemd-cat-native libnetdata) + +install(TARGETS systemd-cat-native + COMPONENT netdata + DESTINATION usr/sbin) + +# +# build log2journal +# + +pkg_check_modules(PCRE2 libpcre2-8) + +if(PCRE2_FOUND) + set(LOG2JOURNAL_FILES + ${CONFIG_H} + src/collectors/log2journal/log2journal.h + src/collectors/log2journal/log2journal.c + src/collectors/log2journal/log2journal-help.c + src/collectors/log2journal/log2journal-yaml.c + src/collectors/log2journal/log2journal-json.c + src/collectors/log2journal/log2journal-logfmt.c + src/collectors/log2journal/log2journal-pcre2.c + src/collectors/log2journal/log2journal-params.c + src/collectors/log2journal/log2journal-inject.c + src/collectors/log2journal/log2journal-pattern.c + src/collectors/log2journal/log2journal-replace.c + src/collectors/log2journal/log2journal-rename.c + src/collectors/log2journal/log2journal-rewrite.c + ) + + add_executable(log2journal ${LOG2JOURNAL_FILES}) + target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS}) + target_compile_options(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER}) + target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}") + + netdata_add_libyaml_to_target(log2journal) + + install(TARGETS log2journal + COMPONENT netdata + DESTINATION usr/sbin) + + install(DIRECTORY src/collectors/log2journal/log2journal.d + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d) endif() -# generate config.h so that CMake becomes independent of automake +# +# build netdatacli +# + +set(NETDATACLI_FILES + src/daemon/commands.h + src/daemon/pipename.c + src/daemon/pipename.h + src/cli/cli.c +) + +add_executable(netdatacli ${NETDATACLI_FILES}) +target_link_libraries(netdatacli libnetdata) + +install(TARGETS netdatacli + COMPONENT netdata + DESTINATION usr/sbin) -## netdata version -set(GIT_EXECUTABLE "git") -execute_process(COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE NETDATA_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +# +# Build go.d.plugin +# -IF("${NETDATA_VERSION}" STREQUAL "") - file(STRINGS "packaging/version" NETDATA_VERSION LIMIT_COUNT 1) -ENDIF() +if(ENABLE_PLUGIN_GO) + add_go_target(go-plugin go.d.plugin src/go/collectors/go.d.plugin cmd/godplugin) -set(NETDATA_USER "netdata" CACHE STRING "use this user to drop privileges") + install(PROGRAMS ${CMAKE_BINARY_DIR}/go.d.plugin + COMPONENT plugin-go + DESTINATION usr/libexec/netdata/plugins.d) +endif() + +# +# Generate config file +# + +if(NOT CMAKE_INSTALL_PREFIX STREQUAL "") + string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") +endif() -if(MAC_OS) - set(ENABLE_APPS_PLUGIN False) +set(CACHE_DIR "${CMAKE_INSTALL_PREFIX}/var/cache/netdata") +set(CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/etc/netdata") +set(LIBCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/conf.d") +set(LOG_DIR "${CMAKE_INSTALL_PREFIX}/var/log/netdata") +set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d") +set(VARLIB_DIR "${CMAKE_INSTALL_PREFIX}/var/lib/netdata") + +# A non-default value is only used when building Debian packages (/var/lib/netdata/www) +if(NOT DEFINED WEB_DIR) + set(WEB_DIR "usr/share/netdata/web") else() - set(ENABLE_APPS_PLUGIN True) + string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}") endif() +set(WEB_DEST "${WEB_DIR}") +set(WEB_DIR "${CMAKE_INSTALL_PREFIX}/${WEB_DEST}") -check_include_file(time.h HAVE_TIME_H) -check_include_file(unistd.h HAVE_UNISTD_H) -if (HAVE_TIME_H) - include(CheckStructHasMember) - check_struct_has_member("struct timespec" tv_sec "time.h" HAVE_STRUCT_TIMESPEC) -endif () -check_include_file(sys/statfs.h HAVE_SYS_STATFS_H) -check_include_file(sys/statvfs.h HAVE_SYS_STATVFS_H) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) +set(CONFIGURE_COMMAND "dummy-configure-command") +if (NOT NETDATA_USER) + set(NETDATA_USER "netdata") +endif() -include(CheckSymbolExists) -check_include_file(sys/mkdev.h HAVE_SYS_MKDEV_H) -if (HAVE_SYS_MKDEV_H) - check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV) +configure_file(packaging/cmake/config.cmake.h.in config.h) + +# +# install +# + +install(TARGETS netdata COMPONENT netdata DESTINATION usr/sbin) + +install(DIRECTORY COMPONENT netdata DESTINATION var/cache/netdata) +install(DIRECTORY COMPONENT netdata DESTINATION var/log/netdata) +install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/registry) +install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/cloud.d) +install(DIRECTORY COMPONENT netdata DESTINATION var/run/netdata) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/custom-plugins.d) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/go.d) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/health.d) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/python.d) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/ssl) +install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/statsd.d) +install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d) +install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d/schema.d) +install(DIRECTORY COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d) +install(DIRECTORY COMPONENT netdata DESTINATION ${WEB_DEST}) + +set(libsysdir_POST "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/system") +set(pkglibexecdir_POST "${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata") +set(localstatedir_POST "${CMAKE_INSTALL_PREFIX}/var") +set(sbindir_POST "${CMAKE_INSTALL_PREFIX}/usr/sbin") +set(configdir_POST "${CMAKE_INSTALL_PREFIX}/etc/netdata") +set(libconfigdir_POST "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/conf.d") +set(cachedir_POST "${CMAKE_INSTALL_PREFIX}/var/cache/netdata") +set(registrydir_POST "${CMAKE_INSTALL_PREFIX}/var/lib/netdata/registry") +set(varlibdir_POST "${CMAKE_INSTALL_PREFIX}/var/lib/netdata") +set(netdata_user_POST "${NETDATA_USER}") + +# netdata-claim.sh +if(ENABLE_CLOUD) + set(enable_cloud_POST "yes") +else() + set(enable_cloud_POST "no") +endif() + +if(ENABLE_ACLK) + set(enable_aclk_POST "yes") +else() + set(enable_aclk_POST "no") +endif() + +configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh + COMPONENT netdata + DESTINATION usr/sbin) + +# +# We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume +# the files exists unconditionally. +# +configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in + src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in + src/collectors/cgroups.plugin/cgroup-name.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +# +# statsd +# +install(FILES + src/collectors/statsd.plugin/asterisk.conf + src/collectors/statsd.plugin/example.conf + src/collectors/statsd.plugin/k6.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d/statsd.d) + +# +# exporting +# +install(FILES + src/exporting/exporting.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d) + +# +# ioping.plugin +# +install(FILES + src/collectors/ioping.plugin/ioping.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d) + +# +# streaming +# +install(FILES + src/streaming/stream.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d) + +# +# swagger +# +install(FILES + src/web/api/netdata-swagger.json + src/web/api/netdata-swagger.yaml + COMPONENT netdata + DESTINATION ${WEB_DEST}) + +# +# service files +# + +configure_file(system/install-service.sh.in system/install-service.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/install-service.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata) + +configure_file(system/cron/netdata-updater-daily.in system/cron/netdata-updater-daily @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily + COMPONENT netdata + DESTINATION usr/lib/netdata/system/cron) + +configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist + COMPONENT netdata + DESTINATION usr/lib/netdata/system/launchd) + +configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/freebsd/rc.d) + +configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/initd/init.d) + +configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/logrotate/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/logrotate) +install(FILES + ${CMAKE_BINARY_DIR}/system/logrotate/netdata + COMPONENT netdata + DESTINATION etc/logrotate.d) + +configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/lsb/init.d) + +configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/openrc/conf.d) + +configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/openrc/init.d) + +configure_file(system/runit/run.in system/runit/run @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/system/runit/run + COMPONENT netdata + DESTINATION usr/lib/netdata/system/runit) + +configure_file(system/dinit/netdata.in system/dinit/netdata @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/dinit/netdata + COMPONENT netdata + DESTINATION usr/lib/netdata/system/dinit) + +configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata.service + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +install(FILES + system/systemd/journald@netdata.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235 + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +configure_file(system/systemd/netdata-updater.service.in system/systemd/netdata-updater.service @ONLY) +install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +install(FILES + system/systemd/netdata-updater.timer + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +if(BUILD_FOR_PACKAGING) + install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata.service + COMPONENT netdata + DESTINATION lib/systemd/system) + install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service + COMPONENT netdata + DESTINATION lib/systemd/system) + install(FILES + system/systemd/netdata-updater.timer + COMPONENT netdata + DESTINATION lib/systemd/system) + install(DIRECTORY + COMPONENT netdata + DESTINATION usr/lib/systemd/journald@netdata.conf.d) + install(FILES + system/systemd/journald@netdata.conf + COMPONENT netdata + DESTINATION usr/lib/systemd/journald@netdata.conf.d + RENAME netdata.conf) endif() -check_include_file(sys/sysmacros.h HAVE_SYS_SYSMACROS_H) -if (HAVE_SYS_SYSMACROS_H) - check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS) + +install(FILES + system/systemd/50-netdata.preset + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + +install(FILES + system/vnodes/vnodes.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d/vnodes) + +install(FILES + system/.install-type + COMPONENT netdata + DESTINATION etc/netdata) + +install(PROGRAMS + system/edit-config + COMPONENT netdata + DESTINATION etc/netdata) + +if(BUILD_FOR_PACKAGING) + set(NETDATA_CONF_DEST "etc/netdata") +else() + set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d") endif() -if (CRYPTO_FOUND) - set(HAVE_CRYPTO True) - FIND_LIBRARY(CRYPTO_LIBRARY_LOCATION NAMES crypto) - check_library_exists(crypto X509_VERIFY_PARAM_set1_host ${CRYPTO_LIBRARY_LOCATION} HAVE_X509_VERIFY_PARAM_set1_host) - if (HAVE_X509_VERIFY_PARAM_set1_host) - set(HAVE_X509_VERIFY_PARAM_set1_host True) +install(FILES + system/netdata.conf + system/netdata-updater.conf + COMPONENT netdata + DESTINATION ${NETDATA_CONF_DEST}) + +# +# misc files +# +if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/deb/netdata/etc/default/netdata + COMPONENT netdata + DESTINATION etc/default) + + install(PROGRAMS + ${PKG_FILES_PATH}/deb/netdata/etc/init.d/netdata + COMPONENT netdata + DESTINATION etc/init.d) +endif() + +install(PROGRAMS + packaging/installer/netdata-updater.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata) + +# +# TODO: check the following files for correct substitutions +# +configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +install(PROGRAMS + src/daemon/system-info.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +# +# health files +# + +file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf") +install(FILES + ${HEALTH_CONF_FILES} + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d/health.d) + +configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +install(PROGRAMS + src/health/notifications/alarm-email.sh + src/health/notifications/alarm-test.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +install(FILES + src/health/notifications/health_alarm_notify.conf + src/health/notifications/health_email_recipients.conf + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d) +# +# test/ files +# + +configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY) +configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY) +configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY) +configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY) +configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY) +configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY) + +install(FILES + ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh + ${CMAKE_BINARY_DIR}/tests/acls/acl.sh + ${CMAKE_BINARY_DIR}/tests/urls/request.sh + ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh + ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh + ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh + DESTINATION usr/libexec/netdata/plugins.d) + +# +# charts.d plugin +# + +install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d) + +configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin + COMPONENT plugin-chartsd + DESTINATION usr/libexec/netdata/plugins.d) + +install(PROGRAMS + src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh + COMPONENT plugin-chartsd + DESTINATION usr/libexec/netdata/plugins.d) + +# loopsleepms is used by the tc.plugin -> ship it in the netdata component +install(FILES + src/collectors/charts.d.plugin/loopsleepms.sh.inc + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +install(FILES + src/collectors/charts.d.plugin/charts.d.conf + COMPONENT plugin-chartsd + DESTINATION usr/lib/netdata/conf.d) + +install(PROGRAMS + src/collectors/charts.d.plugin/ap/ap.chart.sh + src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh + src/collectors/charts.d.plugin/example/example.chart.sh + src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh + src/collectors/charts.d.plugin/opensips/opensips.chart.sh + src/collectors/charts.d.plugin/sensors/sensors.chart.sh + COMPONENT plugin-chartsd + DESTINATION usr/libexec/netdata/charts.d) + +install(FILES + src/collectors/charts.d.plugin/ap/ap.conf + src/collectors/charts.d.plugin/apcupsd/apcupsd.conf + src/collectors/charts.d.plugin/example/example.conf + src/collectors/charts.d.plugin/libreswan/libreswan.conf + src/collectors/charts.d.plugin/opensips/opensips.conf + src/collectors/charts.d.plugin/sensors/sensors.conf + COMPONENT plugin-chartsd + DESTINATION usr/lib/netdata/conf.d/charts.d) + +if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-chartsd + DESTINATION usr/share/doc/netdata-plugin-chartsd) +endif() + +# +# tc-qos-helper +# + +configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY) +install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +# confs +install(FILES + src/collectors/systemd-journal.plugin/schema.d/systemd-journal%3Amonitored-directories.json + src/health/schema.d/health%3Aalert%3Aprototype.json + COMPONENT netdata + DESTINATION usr/lib/netdata/conf.d/schema.d) + +# +# python.d plugin +# + +configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY) +install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin + COMPONENT plugin-pythond + DESTINATION usr/libexec/netdata/plugins.d) + +install(DIRECTORY src/collectors/python.d.plugin/python_modules + COMPONENT plugin-pythond + DESTINATION usr/libexec/netdata/python.d) + +install(FILES src/collectors/python.d.plugin/python.d.conf + COMPONENT plugin-pythond + DESTINATION usr/lib/netdata/conf.d) + +install(FILES + src/collectors/python.d.plugin/alarms/alarms.conf + src/collectors/python.d.plugin/am2320/am2320.conf + src/collectors/python.d.plugin/anomalies/anomalies.conf + src/collectors/python.d.plugin/beanstalk/beanstalk.conf + src/collectors/python.d.plugin/boinc/boinc.conf + src/collectors/python.d.plugin/ceph/ceph.conf + src/collectors/python.d.plugin/changefinder/changefinder.conf + src/collectors/python.d.plugin/dovecot/dovecot.conf + src/collectors/python.d.plugin/example/example.conf + src/collectors/python.d.plugin/exim/exim.conf + src/collectors/python.d.plugin/gearman/gearman.conf + src/collectors/python.d.plugin/go_expvar/go_expvar.conf + src/collectors/python.d.plugin/haproxy/haproxy.conf + src/collectors/python.d.plugin/icecast/icecast.conf + src/collectors/python.d.plugin/ipfs/ipfs.conf + src/collectors/python.d.plugin/memcached/memcached.conf + src/collectors/python.d.plugin/monit/monit.conf + src/collectors/python.d.plugin/nsd/nsd.conf + src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.conf + src/collectors/python.d.plugin/openldap/openldap.conf + src/collectors/python.d.plugin/oracledb/oracledb.conf + src/collectors/python.d.plugin/pandas/pandas.conf + src/collectors/python.d.plugin/postfix/postfix.conf + src/collectors/python.d.plugin/puppet/puppet.conf + src/collectors/python.d.plugin/rethinkdbs/rethinkdbs.conf + src/collectors/python.d.plugin/retroshare/retroshare.conf + src/collectors/python.d.plugin/riakkv/riakkv.conf + src/collectors/python.d.plugin/samba/samba.conf + src/collectors/python.d.plugin/spigotmc/spigotmc.conf + src/collectors/python.d.plugin/squid/squid.conf + src/collectors/python.d.plugin/tomcat/tomcat.conf + src/collectors/python.d.plugin/tor/tor.conf + src/collectors/python.d.plugin/traefik/traefik.conf + src/collectors/python.d.plugin/uwsgi/uwsgi.conf + src/collectors/python.d.plugin/varnish/varnish.conf + src/collectors/python.d.plugin/w1sensor/w1sensor.conf + src/collectors/python.d.plugin/zscores/zscores.conf + COMPONENT plugin-pythond + DESTINATION usr/lib/netdata/conf.d/python.d) + +install(FILES + src/collectors/python.d.plugin/alarms/alarms.chart.py + src/collectors/python.d.plugin/am2320/am2320.chart.py + src/collectors/python.d.plugin/anomalies/anomalies.chart.py + src/collectors/python.d.plugin/beanstalk/beanstalk.chart.py + src/collectors/python.d.plugin/boinc/boinc.chart.py + src/collectors/python.d.plugin/ceph/ceph.chart.py + src/collectors/python.d.plugin/changefinder/changefinder.chart.py + src/collectors/python.d.plugin/dovecot/dovecot.chart.py + src/collectors/python.d.plugin/example/example.chart.py + src/collectors/python.d.plugin/exim/exim.chart.py + src/collectors/python.d.plugin/gearman/gearman.chart.py + src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py + src/collectors/python.d.plugin/haproxy/haproxy.chart.py + src/collectors/python.d.plugin/icecast/icecast.chart.py + src/collectors/python.d.plugin/ipfs/ipfs.chart.py + src/collectors/python.d.plugin/memcached/memcached.chart.py + src/collectors/python.d.plugin/monit/monit.chart.py + src/collectors/python.d.plugin/nsd/nsd.chart.py + src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py + src/collectors/python.d.plugin/openldap/openldap.chart.py + src/collectors/python.d.plugin/oracledb/oracledb.chart.py + src/collectors/python.d.plugin/pandas/pandas.chart.py + src/collectors/python.d.plugin/postfix/postfix.chart.py + src/collectors/python.d.plugin/puppet/puppet.chart.py + src/collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py + src/collectors/python.d.plugin/retroshare/retroshare.chart.py + src/collectors/python.d.plugin/riakkv/riakkv.chart.py + src/collectors/python.d.plugin/samba/samba.chart.py + src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py + src/collectors/python.d.plugin/squid/squid.chart.py + src/collectors/python.d.plugin/tomcat/tomcat.chart.py + src/collectors/python.d.plugin/tor/tor.chart.py + src/collectors/python.d.plugin/traefik/traefik.chart.py + src/collectors/python.d.plugin/uwsgi/uwsgi.chart.py + src/collectors/python.d.plugin/varnish/varnish.chart.py + src/collectors/python.d.plugin/w1sensor/w1sensor.chart.py + src/collectors/python.d.plugin/zscores/zscores.chart.py + COMPONENT plugin-pythond + DESTINATION usr/libexec/netdata/python.d) + +if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-pythond + DESTINATION usr/share/doc/netdata-plugin-pythond) +endif() + +# +# ioping.plugin +# + +configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY) +install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) + +# +# go.d.plugin +# +if(ENABLE_PLUGIN_GO) + install(FILES src/go/collectors/go.d.plugin/config/go.d.conf + COMPONENT plugin-go + DESTINATION usr/lib/netdata/conf.d) + + install(DIRECTORY + COMPONENT plugin-go + DESTINATION usr/lib/netdata/conf.d/go.d) + file(GLOB GO_CONF_FILES src/go/collectors/go.d.plugin/config/go.d/*.conf) + install(FILES ${GO_CONF_FILES} + COMPONENT plugin-go + DESTINATION usr/lib/netdata/conf.d/go.d) + + install(DIRECTORY + COMPONENT plugin-go + DESTINATION usr/lib/netdata/conf.d/go.d/sd) + file(GLOB GO_SD_CONF_FILES src/go/collectors/go.d.plugin/config/go.d/sd/*.conf) + install(FILES ${GO_SD_CONF_FILES} + COMPONENT plugin-go + DESTINATION usr/lib/netdata/conf.d/go.d/sd) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${PKG_FILES_PATH}/copyright + COMPONENT plugin-go + DESTINATION usr/share/doc/netdata-plugin-go) endif() endif() -include(CheckCSourceCompiles) -check_c_source_compiles(" - #define _GNU_SOURCE - #include - int main() { char x = *strerror_r(0, &x, sizeof(x)); return 0; } - " STRERROR_R_CHAR_P) - -IF(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") - SET(LIKELY_MACRO "__builtin_expect(!!(x), 1)") - SET(UNLIKELY_MACRO "__builtin_expect(!!(x), 0)") -ELSE() - SET(LIKELY_MACRO "(x)") - SET(UNLIKELY_MACRO "(x)") -ENDIF() - -IF(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") - SET(ALWAYS_UNUSED_MACRO "__attribute__((unused))") - SET(MAYBE_UNUSED_MACRO "__attribute__((unused))") -ELSE() - SET(ALWAYS_UNUSED_MACRO "") - SET(MAYBE_UNUSED_MACRO "") -ENDIF() - -# ----------------------------------------------------------------------------- - -check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME) - -IF(NOT HAVE_CLOCK_GETTIME) - CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME) -ENDIF() - -IF(HAVE_CLOCK_GETTIME) - message("-- clock_gettime(): found") - set(NETDATA_REQUIRED_DEFINES "-DHAVE_CLOCK_GETTIME=1 ${NETDATA_REQUIRED_DEFINES}") -ELSE() - message("-- clock_gettime(): not found") -ENDIF() - -# ----------------------------------------------------------------------------- -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETDATA_REQUIRED_DEFINES}") -message("CFLAGS=\"${CMAKE_C_FLAGS}\"") - -configure_file(config.cmake.h.in config.h) +# +# dashboard +# + +include(src/web/gui/v1/dashboard_v1.cmake) +include(src/web/gui/v2/dashboard_v2.cmake) +include(src/web/gui/gui.cmake) + +function(cat IN_FILE OUT_FILE) + file(READ ${IN_FILE} CONTENTS) + file(APPEND ${OUT_FILE} "${CONTENTS}") +endfunction() + +file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "") +foreach(JS_FILE ${DASHBOARD_JS_FILES}) + cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in) +endforeach() +configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in + ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY) + +install(FILES + ${CMAKE_BINARY_DIR}/dashboard.js + COMPONENT netdata + DESTINATION ${WEB_DEST}) + +install(FILES + src/web/gui/dashboard_info_custom_example.js + src/web/gui/dashboard_info.js + src/web/gui/index.html + src/web/gui/main.css + src/web/gui/main.js + src/web/gui/registry-access.html + src/web/gui/registry-alert-redirect.html + src/web/gui/registry-hello.html + src/web/gui/switch.html + src/web/gui/ilove.html + COMPONENT netdata + DESTINATION ${WEB_DEST}) + +install(FILES + src/web/gui/old/index.html + COMPONENT netdata + DESTINATION ${WEB_DEST}/old) + +install(FILES + src/web/gui/static/img/netdata-logomark.svg + COMPONENT netdata + DESTINATION ${WEB_DEST}/static/img) + +install(FILES + src/web/gui/css/morris-0.5.1.css + src/web/gui/css/c3-0.4.18.min.css + COMPONENT netdata + DESTINATION ${WEB_DEST}/css) + +install(FILES + src/web/gui/.well-known/dnt/cookies + COMPONENT netdata + DESTINATION ${WEB_DEST}/.well-known/dnt) + +if(NOT OS_WINDOWS) + # v0 dashboard + install(FILES + src/web/gui/v0/index.html + COMPONENT netdata + DESTINATION ${WEB_DEST}/v0) +endif() + +include(Packaging) -- cgit v1.2.3