diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 17:33:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 17:34:10 +0000 |
commit | 83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch) | |
tree | 2e69833b43f791ed253a7a20318b767ebe56cdb8 /CMakeLists.txt | |
parent | Releasing debian version 1.47.5-1. (diff) | |
download | netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip |
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 986 |
1 files changed, 633 insertions, 353 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d9a161e..a5d8d959b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ if(STATIC_BUILD) list(APPEND PKG_CONFIG_EXECUTABLE "--static") endif() +set(CMAKE_INSTALL_MESSAGE LAZY) + set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 14) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata") @@ -118,9 +120,15 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQU endif() set(BINDIR usr/bin) + set(CMAKE_RC_COMPILER_INIT windres) + ENABLE_LANGUAGE(RC) + + SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") add_definitions(-D_GNU_SOURCE) if($ENV{CLION_IDE}) + set(RUN_UNDER_CLION True) + # clion needs these to find the includes if("${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") if("$ENV{MSYSTEM}" STREQUAL "MSYS") @@ -147,15 +155,17 @@ option(DEFAULT_FEATURE_STATE "Specify the default state for most optional featur 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) +option(ENABLE_DASHBOARD "Enable local dashboard" True) +mark_as_advanced(ENABLE_DASHBOARD) # Data collection plugins option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE}) +option(ENABLE_PLUGIN_PYTHON "Enable metric collectors written in Python" ${DEFAULT_FEATURE_STATE}) -cmake_dependent_option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False) +cmake_dependent_option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD OR OS_MACOS OR OS_WINDOWS" False) +cmake_dependent_option(ENABLE_PLUGIN_CHARTS "Enable metric collectors written in Bash" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False) cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False) cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False) @@ -185,7 +195,7 @@ option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False) # 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) +option(ENABLE_H2O "Enable H2O web server (experimental)" False) mark_as_advanced(ENABLE_H2O) # Other optional functionality @@ -198,11 +208,7 @@ 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() +set(NEED_PROTOBUF True) if(ENABLE_PLUGIN_GO) include(NetdataGoTools) @@ -261,6 +267,9 @@ if(ENABLE_PLUGIN_EBPF) netdata_fetch_ebpf_co_re() endif() +pkg_check_modules(CURL libcurl>=7.21 REQUIRED IMPORTED_TARGET) +set(HAVE_LIBCURL TRUE) + # # Libm # @@ -379,6 +388,10 @@ 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_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF) +check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM) +check_function_exists(getrandom HAVE_GETRANDOM) + # # check source compilation # @@ -530,12 +543,22 @@ int my_function() { } " HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT) +# Windows MSVCRT random number generator +# used only when compiling natively (not MSYS/CYGWIN) +check_c_source_compiles(" + #define _CRT_RAND_S + #include <stdlib.h> + int main() { + unsigned int x; + return rand_s(&x); + } +" HAVE_RAND_S) + if(OS_FREEBSD OR OS_MACOS) set(HAVE_BUILTIN_ATOMICS True) endif() # openssl/crypto -set(ENABLE_OPENSSL True) pkg_check_modules(TLS IMPORTED_TARGET openssl) if(NOT TARGET PkgConfig::TLS) @@ -628,8 +651,11 @@ set(LIBNETDATA_FILES src/libnetdata/aral/aral.h src/libnetdata/avl/avl.c src/libnetdata/avl/avl.h + src/libnetdata/bitmap/bitmap64.h src/libnetdata/buffer/buffer.c src/libnetdata/buffer/buffer.h + src/libnetdata/ringbuffer/ringbuffer.c + src/libnetdata/ringbuffer/ringbuffer.h src/libnetdata/circular_buffer/circular_buffer.c src/libnetdata/circular_buffer/circular_buffer.h src/libnetdata/clocks/clocks.c @@ -664,15 +690,15 @@ set(LIBNETDATA_FILES src/libnetdata/line_splitter/line_splitter.c src/libnetdata/line_splitter/line_splitter.h src/libnetdata/libnetdata.h + src/libnetdata/linked_lists/linked_lists.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/log/systemd-journal-helpers.c + src/libnetdata/log/systemd-journal-helpers.h + src/libnetdata/log/nd_log.c + src/libnetdata/log/nd_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 @@ -683,6 +709,8 @@ set(LIBNETDATA_FILES src/libnetdata/required_dummies.h src/libnetdata/socket/security.c src/libnetdata/socket/security.h + src/libnetdata/simple_hashtable/simple_hashtable.h + src/libnetdata/simple_hashtable/simple_hashtable_undef.h src/libnetdata/simple_pattern/simple_pattern.c src/libnetdata/simple_pattern/simple_pattern.h src/libnetdata/socket/socket.c @@ -723,9 +751,9 @@ set(LIBNETDATA_FILES 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/parsers/parsers.h + src/libnetdata/parsers/duration.c src/libnetdata/os/gettid.c src/libnetdata/os/gettid.h src/libnetdata/os/adjtimex.c @@ -746,22 +774,111 @@ set(LIBNETDATA_FILES src/libnetdata/os/os-windows-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/sleep.c + src/libnetdata/os/sleep.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 - src/libnetdata/spawn_server/spawn_server.c + src/libnetdata/os/windows-wmi/windows-wmi.c + src/libnetdata/os/windows-wmi/windows-wmi.h + src/libnetdata/os/windows-wmi/windows-wmi-GetDiskDriveInfo.c + src/libnetdata/os/windows-wmi/windows-wmi-GetDiskDriveInfo.h + src/libnetdata/os/windows-perflib/perflib.c + src/libnetdata/os/windows-perflib/perflib.h + src/libnetdata/os/windows-perflib/perflib-names.c + src/libnetdata/os/windows-perflib/perflib-dump.c + src/libnetdata/os/system-maps/cached-uid-username.c + src/libnetdata/os/system-maps/cached-uid-username.h + src/libnetdata/os/system-maps/cached-sid-username.c + src/libnetdata/os/system-maps/cached-sid-username.h + src/libnetdata/os/system-maps/cached-gid-groupname.c + src/libnetdata/os/system-maps/cached-gid-groupname.h + src/libnetdata/os/system-maps/cache-host-users-and-groups.c + src/libnetdata/os/system-maps/cache-host-users-and-groups.h + src/libnetdata/spawn_server/spawn_server_nofork.c src/libnetdata/spawn_server/spawn_server.h src/libnetdata/spawn_server/spawn_popen.c src/libnetdata/spawn_server/spawn_popen.h + src/libnetdata/spawn_server/spawn_server_windows.c + src/libnetdata/spawn_server/spawn_server_internals.h + src/libnetdata/spawn_server/spawn_server_libuv.c + src/libnetdata/spawn_server/spawn_server_posix.c + src/libnetdata/spawn_server/spawn_library.c + src/libnetdata/spawn_server/spawn_library.h src/libnetdata/os/close_range.c src/libnetdata/os/close_range.h src/libnetdata/os/setproctitle.c src/libnetdata/os/setproctitle.h + src/libnetdata/paths/paths.c + src/libnetdata/paths/paths.h + src/libnetdata/json/json-c-parser-inline.c + src/libnetdata/parsers/duration.h + src/libnetdata/parsers/timeframe.c + src/libnetdata/parsers/timeframe.h + src/libnetdata/parsers/size.c + src/libnetdata/parsers/size.h + src/libnetdata/libjudy/judy-malloc.c + src/libnetdata/libjudy/judy-malloc.h + src/libnetdata/config/appconfig_internals.h + src/libnetdata/config/appconfig_exporters.c + src/libnetdata/config/appconfig_conf_file.c + src/libnetdata/config/appconfig_cleanup.c + src/libnetdata/config/appconfig_sections.c + src/libnetdata/config/appconfig_options.c + src/libnetdata/config/appconfig_migrate.c + src/libnetdata/config/appconfig_traversal.c + src/libnetdata/config/appconfig_api_sizes.c + src/libnetdata/config/appconfig_api_sizes.h + src/libnetdata/config/appconfig_api_durations.c + src/libnetdata/config/appconfig_api_durations.h + src/libnetdata/config/appconfig_api_numbers.c + src/libnetdata/config/appconfig_api_numbers.h + src/libnetdata/config/appconfig_api_text.c + src/libnetdata/config/appconfig_api_text.h + src/libnetdata/config/appconfig_api_boolean.c + src/libnetdata/config/appconfig_api_boolean.h + src/libnetdata/facets/logs_query_status.h + src/libnetdata/os/timestamps.c + src/libnetdata/os/timestamps.h + src/libnetdata/parsers/entries.c + src/libnetdata/parsers/entries.h + src/libnetdata/sanitizers/chart_id_and_name.c + src/libnetdata/sanitizers/chart_id_and_name.h + src/libnetdata/sanitizers/utf8-sanitizer.c + src/libnetdata/sanitizers/utf8-sanitizer.h + src/libnetdata/sanitizers/sanitizers.h + src/libnetdata/sanitizers/sanitizers-labels.c + src/libnetdata/sanitizers/sanitizers-labels.h + src/libnetdata/sanitizers/sanitizers-functions.c + src/libnetdata/sanitizers/sanitizers-functions.h + src/libnetdata/sanitizers/sanitizers-pluginsd.c + src/libnetdata/sanitizers/sanitizers-pluginsd.h + src/libnetdata/log/nd_log-internals.c + src/libnetdata/log/nd_log-internals.h + src/libnetdata/log/nd_log_limit.c + src/libnetdata/log/nd_log_limit.h + src/libnetdata/log/nd_log-config.c + src/libnetdata/log/nd_log-init.c + src/libnetdata/log/nd_log-to-syslog.c + src/libnetdata/log/nd_log-to-systemd-journal.c + src/libnetdata/log/nd_log-annotators.c + src/libnetdata/log/nd_log-field-formatters.c + src/libnetdata/log/nd_log-format-logfmt.c + src/libnetdata/log/nd_log-format-json.c + src/libnetdata/log/nd_log-to-file.c + src/libnetdata/log/nd_log-to-windows-events.c + src/libnetdata/string/utf8.c + src/libnetdata/spawn_server/log-forwarder.c + src/libnetdata/spawn_server/log-forwarder.h + src/libnetdata/log/nd_log-common.h + src/libnetdata/log/nd_log-to-windows-common.h + src/libnetdata/common.h + src/libnetdata/xxHash/xxhash.h + src/libnetdata/os/random.c + src/libnetdata/os/random.h ) if(ENABLE_PLUGIN_EBPF) @@ -856,18 +973,19 @@ set(LIBH2O_FILES set(DAEMON_FILES src/daemon/buildinfo.c src/daemon/buildinfo.h - src/daemon/common.c + src/daemon/h2o-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/libuv_workers.c + src/daemon/libuv_workers.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/environment.c src/daemon/win_system-info.c src/daemon/win_system-info.h src/daemon/signals.c @@ -899,7 +1017,7 @@ set(H2O_FILES 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/rrdpush.c src/web/server/h2o/streaming.h src/web/server/h2o/connlist.c src/web/server/h2o/connlist.h @@ -916,16 +1034,65 @@ set(API_PLUGIN_FILES src/web/api/web_api_v1.h src/web/api/web_api_v2.c src/web/api/web_api_v2.h + src/web/api/web_api_v3.c + src/web/api/web_api_v3.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/maps/rrdr_options.c + src/web/api/maps/rrdr_options.h + src/web/api/maps/contexts_options.c + src/web/api/maps/contexts_options.h + src/web/api/maps/datasource_formats.c + src/web/api/maps/datasource_formats.h + src/web/api/maps/maps.h + src/web/api/maps/contexts_alert_statuses.c + src/web/api/maps/contexts_alert_statuses.h + src/web/api/v1/api_v1_allmetrics.c + src/web/api/v1/api_v1_badge/web_buffer_svg.c + src/web/api/v1/api_v1_function.c + src/web/api/v1/api_v1_manage.c + src/web/api/v1/api_v1_calls.h + src/web/api/v1/api_v1_dbengine.c + src/web/api/v1/api_v1_config.c + src/web/api/v1/api_v1_functions.c + src/web/api/v1/api_v1_weights.c + src/web/api/v1/api_v1_info.c + src/web/api/v1/api_v1_registry.c + src/web/api/v1/api_v1_data.c + src/web/api/v1/api_v1_contexts.c + src/web/api/v1/api_v1_ml_info.c + src/web/api/v1/api_v1_aclk.c + src/web/api/v1/api_v1_context.c + src/web/api/v1/api_v1_alarms.c + src/web/api/v1/api_v1_charts.c + src/web/api/v2/api_v2_info.c + src/web/api/v2/api_v2_nodes.c + src/web/api/v2/api_v2_node_instances.c + src/web/api/v2/api_v2_q.c + src/web/api/v2/api_v2_versions.c + src/web/api/v2/api_v2_functions.c + src/web/api/v2/api_v2_alerts.c + src/web/api/v2/api_v2_alert_transitions.c + src/web/api/v2/api_v2_ilove/ilove.c + src/web/api/v2/api_v2_bearer.c + src/web/api/v2/api_v2_calls.h + src/web/api/v2/api_v2_data.c + src/web/api/v2/api_v2_progress.c + src/web/api/v2/api_v2_weights.c + src/web/api/v2/api_v2_alert_config.c + src/web/api/v2/api_v2_contexts.c + src/web/api/v2/api_v2_claim.c + src/web/api/v2/api_v2_webrtc.c + src/web/api/v3/api_v3_calls.h + src/web/api/v3/api_v3_settings.c + src/web/api/functions/functions.c + src/web/api/functions/functions.h + src/web/api/functions/function-progress.c + src/web/api/functions/function-progress.h + src/web/api/functions/function-streaming.c + src/web/api/functions/function-streaming.h src/web/api/queries/rrdr.c src/web/api/queries/rrdr.h src/web/api/queries/query.c @@ -972,10 +1139,11 @@ set(API_PLUGIN_FILES 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 + src/web/api/functions/function-bearer_get_token.c + src/web/api/functions/function-bearer_get_token.h + src/web/api/v3/api_v3_me.c ) set(EXPORTING_ENGINE_FILES @@ -1040,34 +1208,48 @@ 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.interrupts.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 + src/collectors/common-contexts/disk-await.h + src/collectors/common-contexts/disk-avgsz.h + src/collectors/common-contexts/disk-busy.h + src/collectors/common-contexts/disk-io.h + src/collectors/common-contexts/disk-iotime.h + src/collectors/common-contexts/disk-ops.h + src/collectors/common-contexts/disk-qops.h + src/collectors/common-contexts/disk-svctm.h + src/collectors/common-contexts/disk-util.h + src/collectors/common-contexts/system-io.h + src/collectors/common-contexts/system-interrupts.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 - 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 + src/plugins.d/plugins_d.c + src/plugins.d/plugins_d.h + src/plugins.d/pluginsd_dyncfg.c + src/plugins.d/pluginsd_dyncfg.h + src/plugins.d/pluginsd_functions.c + src/plugins.d/pluginsd_functions.h + src/plugins.d/pluginsd_internals.c + src/plugins.d/pluginsd_internals.h + src/plugins.d/pluginsd_parser.c + src/plugins.d/pluginsd_parser.h + src/plugins.d/pluginsd_replication.c + src/plugins.d/pluginsd_replication.h ) set(RRD_PLUGIN_FILES - src/database/contexts/api_v1.c - src/database/contexts/api_v2.c + src/database/contexts/api_v1_contexts.c + src/database/contexts/api_v2_contexts.c + src/database/contexts/api_v2_contexts.h + src/database/contexts/api_v2_contexts_agents.c + src/database/contexts/api_v2_contexts_alerts.c + src/database/contexts/api_v2_contexts_alerts.h + src/database/contexts/api_v2_contexts_alert_transitions.c + src/database/contexts/api_v2_contexts_alert_config.c src/database/contexts/context.c src/database/contexts/instance.c src/database/contexts/internal.h @@ -1084,10 +1266,6 @@ set(RRD_PLUGIN_FILES 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 @@ -1188,29 +1366,54 @@ set(SYSTEMD_JOURNAL_PLUGIN_FILES 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 - src/libnetdata/maps/system-services.h + src/libnetdata/os/system-maps/system-services.h + src/collectors/systemd-journal.plugin/systemd-journal-sampling.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/stream-compression/compression.c + src/streaming/stream-compression/compression.h + src/streaming/stream-compression/brotli.c + src/streaming/stream-compression/brotli.h + src/streaming/stream-compression/gzip.c + src/streaming/stream-compression/gzip.h + src/streaming/stream-compression/lz4.c + src/streaming/stream-compression/lz4.h + src/streaming/stream-compression/zstd.c + src/streaming/stream-compression/zstd.h src/streaming/receiver.c src/streaming/sender.c src/streaming/replication.c src/streaming/replication.h - src/streaming/common.h + src/streaming/h2o-common.h + src/streaming/protocol/command-nodeid.c + src/streaming/protocol/commands.c + src/streaming/protocol/commands.h + src/streaming/protocol/command-claimed_id.c + src/streaming/stream-path.c + src/streaming/stream-path.h + src/streaming/stream-capabilities.c + src/streaming/stream-capabilities.h + src/streaming/sender-connect.c + src/streaming/sender-internals.h + src/streaming/sender-execute.c + src/streaming/sender-commit.c + src/streaming/sender-destinations.c + src/streaming/stream-handshake.c + src/streaming/protocol/command-function.c + src/streaming/protocol/command-host-labels.c + src/streaming/protocol/command-chart-definition.c + src/streaming/protocol/command-begin-set-end.c + src/streaming/protocol/command-host-variables.c + src/streaming/stream-conf.c + src/streaming/stream-conf.h + src/streaming/stream-handshake.h + src/streaming/sender.h + src/streaming/sender-destinations.h + src/streaming/rrdhost-status.c + src/streaming/rrdhost-status.h + src/streaming/receiver.h ) set(WEB_PLUGIN_FILES @@ -1227,10 +1430,22 @@ set(WEB_PLUGIN_FILES set(CLAIM_PLUGIN_FILES src/claim/claim.c src/claim/claim.h + src/claim/claim_id.c + src/claim/claim_id.h + src/claim/cloud-conf.c + src/claim/claim-with-api.c + src/claim/cloud-status.c + src/claim/cloud-status.h +) + +set(CLAIM_WINDOWS_FILES + src/claim/main.c + src/claim/main.h + src/claim/ui.c + src/claim/ui.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 @@ -1241,12 +1456,9 @@ set(ACLK_ALWAYS_BUILD 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 + src/libnetdata/c_rhash/c_rhash.c + src/libnetdata/c_rhash/c_rhash.h + src/libnetdata/c_rhash/c_rhash_internal.h ) set(TIMEX_PLUGIN_FILES @@ -1291,24 +1503,45 @@ set(FREEBSD_PLUGIN_FILES src/collectors/proc.plugin/zfs_common.h ) +set(WINDOWS_EVENTS_PLUGIN_FILES + src/collectors/windows-events.plugin/windows-events.c + src/collectors/windows-events.plugin/windows-events.h + src/collectors/windows-events.plugin/windows-events-query.h + src/collectors/windows-events.plugin/windows-events-query.c + src/collectors/windows-events.plugin/windows-events-sources.c + src/collectors/windows-events.plugin/windows-events-sources.h + src/collectors/windows-events.plugin/windows-events-unicode.c + src/collectors/windows-events.plugin/windows-events-unicode.h + src/collectors/windows-events.plugin/windows-events-xml.c + src/collectors/windows-events.plugin/windows-events-xml.h + src/collectors/windows-events.plugin/windows-events-providers.c + src/collectors/windows-events.plugin/windows-events-providers.h + src/collectors/windows-events.plugin/windows-events-fields-cache.c + src/collectors/windows-events.plugin/windows-events-fields-cache.h + src/collectors/windows-events.plugin/windows-events-query-builder.c + src/collectors/windows-events.plugin/windows-events-query-builder.h + src/collectors/windows-events.plugin/windows-events-query-evt-variant.c +) + 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-mssql.c src/collectors/windows.plugin/perflib-storage.c src/collectors/windows.plugin/perflib-processor.c + src/collectors/windows.plugin/perflib-thermalzone.c src/collectors/windows.plugin/perflib-objects.c src/collectors/windows.plugin/perflib-network.c + src/collectors/windows.plugin/perflib-netframework.c src/collectors/windows.plugin/perflib-memory.c src/collectors/windows.plugin/perflib-processes.c + src/collectors/windows.plugin/perflib-web-service.c + src/collectors/windows.plugin/perflib-hyperv.c ) set(PROC_PLUGIN_FILES @@ -1424,8 +1657,6 @@ endif() 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 @@ -1450,8 +1681,6 @@ set(ACLK_PROTO_DEFS ) 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 @@ -1491,8 +1720,6 @@ set(ACLK_FILES 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 ) @@ -1596,10 +1823,90 @@ target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOUR target_link_libraries(libnetdata PUBLIC "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>" "$<$<OR:$<BOOL:${OS_LINUX}>,$<BOOL:${OS_FREEBSD}>>:pthread;rt>" - "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4>" + "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4;wevtapi;ole32;oleaut32;wbemuuid>" "$<$<BOOL:${LINK_LIBM}>:m>" "${SYSTEMD_LDFLAGS}") +if(OS_WINDOWS) + set(HAVE_ETW True) + set(HAVE_WEL True) + + # Output the results for debugging purposes + message(STATUS "Have Event Tracing for Windows (ETW): ${HAVE_ETW}") + message(STATUS "Have Windows Event Log (WEL): ${HAVE_WEL}") + + if(HAVE_WEL OR HAVE_ETW) + # Define the source and generated file paths + set(WEVT_GEN_SRC_H_FILE "${CMAKE_SOURCE_DIR}/src/libnetdata/log/nd_log-to-windows-common.h") + set(WEVT_GEN_SRC_C_FILE "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_mc_generate.c") + set(WEVT_GEN_BIN_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_mc_generate") + + set(WEVT_BUILD_SCRIPT "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_compile.sh") + + set(WEVT_MC_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.mc") + set(WEVT_MAN_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_manifest.xml") + set(WEVT_RC_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.rc") + set(WEVT_MC_H_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.h") + set(WEVT_MAN_H_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_manifest.h") + set(WEVT_RES_OBJECT "${CMAKE_BINARY_DIR}/wevt_netdata_res.o") + + set(WEVT_DLL_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.dll") + set(WEVT_ETW_INSTALL_SCRIPT "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_install.bat") + + # we compile ${WEVT_GEN_BIN_FILE}, which generates the manifest, the .mc, + # and the headers required for compiling libnetdata/logs + + if(HAVE_ETW) + # ETW method also supports WEL + # but it requires Microsoft tools mc, rc, and link + add_custom_command( + OUTPUT "${WEVT_MC_H_FILE}" "${WEVT_MAN_H_FILE}" "${WEVT_DLL_FILE}" + COMMAND "${CMAKE_C_COMPILER}" -o "${WEVT_GEN_BIN_FILE}" "${WEVT_GEN_SRC_C_FILE}" + COMMAND "${WEVT_GEN_BIN_FILE}" >"${WEVT_MC_FILE}" + COMMAND "${WEVT_GEN_BIN_FILE}" --manifest >"${WEVT_MAN_FILE}" + COMMAND "${WEVT_BUILD_SCRIPT}" "${CMAKE_SOURCE_DIR}/src/libnetdata/log" "${CMAKE_BINARY_DIR}" + DEPENDS "${WEVT_GEN_SRC_C_FILE}" "${WEVT_GEN_SRC_H_FILE}" + COMMENT "Compiling ${WEVT_MC_FILE} to generate ${WEVT_MC_H_FILE} and ${WEVT_DLL_FILE}" + ) + else() + # WEL method can be built with windmc, windres and the normal linker + add_custom_command( + OUTPUT "${WEVT_MC_H_FILE}" "${WEVT_DLL_FILE}" + COMMAND "${CMAKE_C_COMPILER}" -o "${WEVT_GEN_BIN_FILE}" "${WEVT_GEN_SRC_C_FILE}" + COMMAND "${WEVT_GEN_BIN_FILE}" >"${WEVT_MC_FILE}" + COMMAND "${WEVT_GEN_BIN_FILE}" --manifest >"${WEVT_MAN_FILE}" + COMMAND windmc -r "${CMAKE_BINARY_DIR}" -h "${CMAKE_BINARY_DIR}" ${WEVT_MC_FILE} + COMMAND echo "1 2004" "wevt_netdata_manifest.xml" >> "${WEVT_RC_FILE}" + COMMAND windres ${WEVT_RC_FILE} -o ${WEVT_RES_OBJECT} + COMMAND ${CMAKE_LINKER} -dll --entry 0 -nostdlib -o ${WEVT_DLL_FILE} ${WEVT_RES_OBJECT} + DEPENDS "${WEVT_GEN_SRC_C_FILE}" "${WEVT_GEN_SRC_H_FILE}" + COMMENT "Compiling ${WEVT_MC_FILE} to generate ${WEVT_MC_H_FILE} and ${WEVT_DLL_FILE}" + ) + endif() + + # Create a custom target for the DLL + add_custom_target(wevt_netdata ALL DEPENDS ${WEVT_DLL_FILE}) + + set_source_files_properties(src/libnetdata/log/nd_log-to-windows-events.c PROPERTIES + OBJECT_DEPENDS "${WEVT_MC_H_FILE}") + + if(HAVE_ETW) + set_source_files_properties(src/libnetdata/log/nd_log-to-windows-events.c PROPERTIES + OBJECT_DEPENDS "${WEVT_MAN_H_FILE}") + + install(FILES "${WEVT_DLL_FILE}" "${WEVT_MAN_FILE}" "${WEVT_ETW_INSTALL_SCRIPT}" + COMPONENT wevt_netdata_dll + DESTINATION "${BINDIR}") + else() + # do not install the manifest in this case + # the nsi installer will skip registering the ETW publisher + install(FILES "${WEVT_DLL_FILE}" + COMPONENT wevt_netdata_dll + DESTINATION "${BINDIR}") + endif() + endif() +endif() + # ebpf if(ENABLE_PLUGIN_EBPF) netdata_add_libbpf_to_target(libnetdata) @@ -1690,10 +1997,7 @@ endif() # # mqtt library # -if (ENABLE_H2O OR ENABLE_ACLK) - set(ENABLE_MQTTWEBSOCKETS True) -endif() - +set(ENABLE_MQTTWEBSOCKETS True) if(ENABLE_MQTTWEBSOCKETS) add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES}) @@ -1708,20 +2012,17 @@ if(ENABLE_MQTTWEBSOCKETS) 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}) +# +# 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}) -endif() +list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS} + ${ACLK_PROTO_BUILT_HDRS}) # # build plugins @@ -1753,6 +2054,9 @@ if(ENABLE_PLUGIN_DEBUGFS) endif() endif() +add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c) +target_link_libraries(spawn-tester libnetdata) + if(ENABLE_PLUGIN_APPS) pkg_check_modules(CAP QUIET libcap) @@ -1761,21 +2065,24 @@ if(ENABLE_PLUGIN_APPS) 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 + src/collectors/apps.plugin/apps_pid_files.c + src/collectors/apps.plugin/apps_pid.c + src/collectors/apps.plugin/apps_aggregations.c + src/collectors/apps.plugin/apps_os_linux.c + src/collectors/apps.plugin/apps_os_freebsd.c + src/collectors/apps.plugin/apps_os_macos.c + src/collectors/apps.plugin/apps_os_windows.c + src/collectors/apps.plugin/apps_incremental_collection.c + src/collectors/apps.plugin/apps_os_windows_nt.c + src/collectors/apps.plugin/apps_pid_match.c ) add_executable(apps.plugin ${APPS_PLUGIN_FILES}) - target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES}) + + target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES} + "$<$<BOOL:${OS_WINDOWS}>:Version;ntdll>") + target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS}) target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER}) @@ -1948,7 +2255,7 @@ if(ENABLE_PLUGIN_CUPS) endif() if(NEED_NDSUDO) - set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c) + set(NDSUDO_FILES src/collectors/utils/ndsudo.c) add_executable(ndsudo ${NDSUDO_FILES}) @@ -1988,6 +2295,15 @@ if(ENABLE_PLUGIN_SYSTEMD_JOURNAL) endif() endif() +if(OS_WINDOWS) + add_executable(windows-events.plugin ${WINDOWS_EVENTS_PLUGIN_FILES}) + target_link_libraries(windows-events.plugin libnetdata wevtapi) + + install(TARGETS windows-events.plugin + COMPONENT plugin-windows-events + DESTINATION usr/libexec/netdata/plugins.d) +endif() + if(ENABLE_PLUGIN_EBPF) set(EBPF_PLUGIN_FILES src/collectors/ebpf.plugin/ebpf.c @@ -2083,8 +2399,8 @@ endif() if(ENABLE_PLUGIN_LOCAL_LISTENERS) set(LOCAL_LISTENERS_FILES - src/collectors/plugins.d/local_listeners.c - src/libnetdata/maps/local-sockets.h + src/collectors/utils/local_listeners.c + src/libnetdata/local-sockets/local-sockets.h ) add_executable(local-listeners ${LOCAL_LISTENERS_FILES}) @@ -2103,8 +2419,7 @@ endif() if(ENABLE_PLUGIN_NETWORK_VIEWER) set(NETWORK_VIEWER_FILES - src/libnetdata/maps/local-sockets.h - src/libnetdata/maps/system-users.h + src/libnetdata/local-sockets/local-sockets.h src/collectors/network-viewer.plugin/network-viewer.c ) @@ -2175,14 +2490,39 @@ endif() # build netdata (only Linux ATM) # +if(OS_WINDOWS) + set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc") + configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY) + + set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc") + configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY) + + set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc") + configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY) + + configure_file(packaging/windows/netdata.wxs.in netdata.wxs @ONLY) + configure_file(packaging/windows/NetdataWhite.ico NetdataWhite.ico COPYONLY) + configure_file(packaging/windows/gpl-3.0.rtf gpl-3.0.rtf COPYONLY) + configure_file(packaging/windows/ncul1.rtf ncul1.rtf COPYONLY) + configure_file(packaging/windows/Top.bmp Top.bmp COPYONLY) + configure_file(packaging/windows/BackGround.bmp BackGround.bmp COPYONLY) +endif() + add_executable(netdata ${NETDATA_FILES} - "$<$<BOOL:${ENABLE_ACLK}>:${ACLK_FILES}>" + "${ACLK_FILES}" "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>" "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>" "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>" + "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>" ) +if(OS_WINDOWS) + add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES}) + target_link_libraries(NetdataClaim shell32 gdi32 msftedit) + target_compile_options(NetdataClaim PUBLIC -mwindows) +endif() + target_compile_definitions(netdata PRIVATE "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>" ) @@ -2193,7 +2533,7 @@ target_compile_options(netdata PRIVATE ) target_include_directories(netdata PRIVATE - "$<$<BOOL:${ENABLE_ACLK}>:${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas>" + "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>" "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>" ) @@ -2209,6 +2549,7 @@ target_link_libraries(netdata PRIVATE "$<$<BOOL:${ENABLE_SENTRY}>:sentry>" "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>" "$<$<BOOL:${ENABLE_H2O}>:h2o>" + "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>" ) if(NEED_PROTOBUF) @@ -2222,7 +2563,10 @@ 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) +target_link_libraries(systemd-cat-native + libnetdata + "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>" +) install(TARGETS systemd-cat-native COMPONENT netdata @@ -2250,13 +2594,16 @@ if(PCRE2_FOUND) src/collectors/log2journal/log2journal-replace.c src/collectors/log2journal/log2journal-rename.c src/collectors/log2journal/log2journal-rewrite.c + src/collectors/log2journal/log2journal-txt.h + src/collectors/log2journal/log2journal-hashed-key.h ) 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}") + target_link_libraries(log2journal PUBLIC libnetdata) + target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}") netdata_add_libyaml_to_target(log2journal) install(TARGETS log2journal @@ -2279,7 +2626,7 @@ set(NETDATACLI_FILES src/cli/cli.c ) -add_executable(netdatacli ${NETDATACLI_FILES}) +add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>") target_link_libraries(netdatacli libnetdata) install(TARGETS netdatacli @@ -2342,9 +2689,7 @@ 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) @@ -2362,26 +2707,21 @@ set(cachedir_POST "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata") set(registrydir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata/registry") set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata") set(netdata_user_POST "${NETDATA_USER}") +set(netdata_group_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") +if(NOT OS_WINDOWS) + 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 "${BINDIR}") else() - set(enable_aclk_POST "no") + install(PROGRAMS + ${CMAKE_BINARY_DIR}/NetdataClaim.exe + COMPONENT netdata + DESTINATION "${BINDIR}") 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 "${BINDIR}") - # # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume # the files exists unconditionally. @@ -2704,64 +3044,66 @@ endif() # charts.d plugin # -install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d) +if(ENABLE_PLUGIN_CHARTS) + 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) + 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) + 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(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/example/example.chart.sh + src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh + src/collectors/charts.d.plugin/opensips/opensips.chart.sh + COMPONENT plugin-chartsd + DESTINATION usr/libexec/netdata/charts.d) -install(PROGRAMS - 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/example/example.conf + src/collectors/charts.d.plugin/libreswan/libreswan.conf + src/collectors/charts.d.plugin/opensips/opensips.conf + COMPONENT plugin-chartsd + DESTINATION usr/lib/netdata/conf.d/charts.d) -install(FILES - 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() +endif() -if(BUILD_FOR_PACKAGING) - install(FILES - ${PKG_FILES_PATH}/copyright - COMPONENT plugin-chartsd - DESTINATION usr/share/doc/netdata-plugin-chartsd) +# This is needed both by the TC plugin (which only gets built on Linux) and the charts plugin. +if(OS_LINUX OR ENABLE_PLUGIN_CHARTS) + install(FILES + src/collectors/charts.d.plugin/loopsleepms.sh.inc + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) 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) +if(OS_LINUX) + 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) +endif() # confs install(FILES @@ -2774,62 +3116,51 @@ install(FILES # 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) +if(ENABLE_PLUGIN_PYTHON) + install(DIRECTORY COMPONENT plugin-pythond DESTINATION etc/netdata/python.d) -install(DIRECTORY src/collectors/python.d.plugin/python_modules - COMPONENT plugin-pythond - DESTINATION usr/libexec/netdata/python.d) + 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(FILES src/collectors/python.d.plugin/python.d.conf - COMPONENT plugin-pythond - DESTINATION usr/lib/netdata/conf.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/am2320/am2320.conf - src/collectors/python.d.plugin/anomalies/anomalies.conf - src/collectors/python.d.plugin/boinc/boinc.conf - src/collectors/python.d.plugin/ceph/ceph.conf - src/collectors/python.d.plugin/go_expvar/go_expvar.conf - src/collectors/python.d.plugin/haproxy/haproxy.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/samba/samba.conf - src/collectors/python.d.plugin/spigotmc/spigotmc.conf - src/collectors/python.d.plugin/traefik/traefik.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) + if(OS_WINDOWS) + include(NetdataUtil) + precompile_python(usr/libexec/netdata/python.d plugin-pythond) + endif() -install(FILES - src/collectors/python.d.plugin/am2320/am2320.chart.py - src/collectors/python.d.plugin/anomalies/anomalies.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/go_expvar/go_expvar.chart.py - src/collectors/python.d.plugin/haproxy/haproxy.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/samba/samba.chart.py - src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py - src/collectors/python.d.plugin/traefik/traefik.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) + install(FILES src/collectors/python.d.plugin/python.d.conf + COMPONENT plugin-pythond + DESTINATION usr/lib/netdata/conf.d) -if(BUILD_FOR_PACKAGING) - install(FILES - ${PKG_FILES_PATH}/copyright - COMPONENT plugin-pythond - DESTINATION usr/share/doc/netdata-plugin-pythond) + install(FILES + src/collectors/python.d.plugin/am2320/am2320.conf + src/collectors/python.d.plugin/go_expvar/go_expvar.conf + src/collectors/python.d.plugin/haproxy/haproxy.conf + src/collectors/python.d.plugin/pandas/pandas.conf + src/collectors/python.d.plugin/traefik/traefik.conf + COMPONENT plugin-pythond + DESTINATION usr/lib/netdata/conf.d/python.d) + + install(FILES + src/collectors/python.d.plugin/am2320/am2320.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/pandas/pandas.chart.py + src/collectors/python.d.plugin/traefik/traefik.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() endif() # @@ -2845,6 +3176,8 @@ install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin # go.d.plugin # if(ENABLE_PLUGIN_GO) + install(DIRECTORY COMPONENT plugin-go DESTINATION etc/netdata/go.d) + install(FILES src/go/plugin/go.d/config/go.d.conf COMPONENT plugin-go DESTINATION usr/lib/netdata/conf.d) @@ -2877,129 +3210,76 @@ endif() # dashboard # -include(src/web/gui/v1/dashboard_v1.cmake) -include(src/web/gui/v2/dashboard_v2.cmake) -include(src/web/gui/gui.cmake) +if(ENABLE_DASHBOARD) + include(NetdataDashboard) + bundle_dashboard() -function(cat IN_FILE OUT_FILE) - file(READ ${IN_FILE} CONTENTS) - file(APPEND ${OUT_FILE} "${CONTENTS}") -endfunction() + include(src/web/gui/v1/dashboard_v1.cmake) + include(src/web/gui/gui.cmake) -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) + function(cat IN_FILE OUT_FILE) + file(READ ${IN_FILE} CONTENTS) + file(APPEND ${OUT_FILE} "${CONTENTS}") + endfunction() -install(FILES - ${CMAKE_BINARY_DIR}/dashboard.js - COMPONENT netdata - DESTINATION ${WEB_DEST}) + file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "") -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}) + foreach(JS_FILE ${DASHBOARD_JS_FILES}) + cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in) + endforeach() -install(FILES - src/web/gui/old/index.html - COMPONENT netdata - DESTINATION ${WEB_DEST}/old) + configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in + ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY) -install(FILES - src/web/gui/static/img/netdata-logomark.svg - COMPONENT netdata - DESTINATION ${WEB_DEST}/static/img) + install(FILES + ${CMAKE_BINARY_DIR}/dashboard.js + COMPONENT dashboard + DESTINATION ${WEB_DEST}) -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/dashboard_info_custom_example.js + src/web/gui/dashboard_info.js + src/web/gui/main.css + src/web/gui/main.js + src/web/gui/switch.html + src/web/gui/ilove.html + COMPONENT dashboard + DESTINATION ${WEB_DEST}) -install(FILES - src/web/gui/.well-known/dnt/cookies - COMPONENT netdata - DESTINATION ${WEB_DEST}/.well-known/dnt) + install(FILES + src/web/gui/old/index.html + COMPONENT dashboard + DESTINATION ${WEB_DEST}/old) -if(NOT OS_WINDOWS) - # v0 dashboard - install(FILES - src/web/gui/v0/index.html - COMPONENT netdata - DESTINATION ${WEB_DEST}/v0) + install(FILES + src/web/gui/static/img/netdata-logomark.svg + COMPONENT dashboard + 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 dashboard + DESTINATION ${WEB_DEST}/css) + + install(FILES + src/web/gui/.well-known/dnt/cookies + COMPONENT dashboard + DESTINATION ${WEB_DEST}/.well-known/dnt) + + if(NOT OS_WINDOWS) + # v0 dashboard + install(FILES + src/web/gui/v0/index.html + COMPONENT dashboard + DESTINATION ${WEB_DEST}/v0) + endif() endif() if(OS_WINDOWS) - install(FILES /usr/bin/awk.exe - /usr/bin/bash.exe - /usr/bin/cat.exe - /usr/bin/chown.exe - /usr/bin/curl.exe - /usr/bin/env.exe - /usr/bin/grep.exe - /usr/bin/mkdir.exe - /usr/bin/openssl.exe - /usr/bin/rm.exe - /usr/bin/sed.exe - /usr/bin/sh.exe - /usr/bin/tail.exe - /usr/bin/tr.exe - /usr/bin/uuidgen.exe - /usr/bin/whoami.exe - DESTINATION "${BINDIR}") - - install(FILES /usr/bin/msys-2.0.dll - /usr/bin/msys-asn1-8.dll - /usr/bin/msys-brotlicommon-1.dll - /usr/bin/msys-brotlidec-1.dll - /usr/bin/msys-brotlienc-1.dll - /usr/bin/msys-com_err-1.dll - /usr/bin/msys-crypt-2.dll - /usr/bin/msys-crypto-3.dll - /usr/bin/msys-curl-4.dll - /usr/bin/msys-gcc_s-seh-1.dll - /usr/bin/msys-gmp-10.dll - /usr/bin/msys-gssapi-3.dll - /usr/bin/msys-hcrypto-4.dll - /usr/bin/msys-heimbase-1.dll - /usr/bin/msys-heimntlm-0.dll - /usr/bin/msys-hx509-5.dll - /usr/bin/msys-iconv-2.dll - /usr/bin/msys-idn2-0.dll - /usr/bin/msys-intl-8.dll - /usr/bin/msys-krb5-26.dll - /usr/bin/msys-lz4-1.dll - /usr/bin/msys-mpfr-6.dll - /usr/bin/msys-ncursesw6.dll - /usr/bin/msys-nghttp2-14.dll - /usr/bin/msys-pcre-1.dll - /usr/bin/msys-protobuf-32.dll - /usr/bin/msys-psl-5.dll - /usr/bin/msys-readline8.dll - /usr/bin/msys-roken-18.dll - /usr/bin/msys-sqlite3-0.dll - /usr/bin/msys-ssh2-1.dll - /usr/bin/msys-ssl-3.dll - /usr/bin/msys-stdc++-6.dll - /usr/bin/msys-unistring-5.dll - /usr/bin/msys-uuid-1.dll + install(FILES /usr/bin/msys-protobuf-32.dll /usr/bin/msys-uv-1.dll - /usr/bin/msys-wind-0.dll - /usr/bin/msys-z.dll - /usr/bin/msys-zstd-1.dll - DESTINATION "${BINDIR}") + DESTINATION "${BINDIR}") # Make bash & netdata happy install(DIRECTORY DESTINATION tmp) |