master
txt 4,346 lines 163 KB
Raw
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 cmake_minimum_required(VERSION 3.16.0...3.30)
4
5 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/Modules")
6
7 include(NetdataVersion)
8 netdata_version()
9
10 if(NOT CMAKE_BUILD_TYPE)
11 set(ENV{CMAKE_BUILD_TYPE} "RelWithDebInfo")
12 set(CMAKE_BUILD_TYPE "RelWithDebInfo")
13 endif()
14
15 project(netdata
16 VERSION "${NETDATA_VERSION_MAJOR}.${NETDATA_VERSION_MINOR}.${NETDATA_VERSION_PATCH}.${NETDATA_VERSION_TWEAK}"
17 HOMEPAGE_URL "https://www.netdata.cloud"
18 LANGUAGES C CXX)
19 include(CMakeDependentOption)
20 include(CMakePushCheckState)
21 include(NetdataUtil)
22 netdata_fixup_system_processor()
23
24 option(STATIC_BUILD "Use static linking instead of dynamic linking for the build." FALSE)
25 mark_as_advanced(STATIC_BUILD)
26 set(BUILD_SHARED_LIBS "${STATIC_BUILD}")
27
28 if(STATIC_BUILD)
29 set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX}")
30 set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
31 endif()
32
33 find_package(PkgConfig REQUIRED)
34
35 if(STATIC_BUILD)
36 list(APPEND PKG_CONFIG_EXECUTABLE "--static")
37 endif()
38
39 set(CMAKE_INSTALL_MESSAGE LAZY)
40 set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata")
41
42 if("c_std_17" IN_LIST CMAKE_C_KNOWN_FEATURES)
43 set(CMAKE_C_STANDARD 17)
44 else()
45 set(CMAKE_C_STANDARD 11)
46 endif()
47
48 set(CMAKE_CXX_STANDARD 17)
49
50 option(USE_CXX_11 "Use C++11 instead of C++17 (should only be used on legacy systems that cannot support C++17, may disable some features)" False)
51 mark_as_advanced(USE_CXX_11)
52
53 if(USE_CXX_11)
54 set(CMAKE_CXX_STANDARD 11)
55 endif()
56
57 set(CMAKE_C_STANDARD_REQUIRED On)
58 set(CMAKE_CXX_STANDARD_REQUIRED On)
59
60 set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
61
62 set(CMAKE_EXPORT_COMPILE_COMMANDS On)
63
64 # Check for the mold linker and try to use it if available
65 option(USE_MOLD "If the MOLD linker is available on the system, use it instead of the default linker." TRUE)
66
67 if(USE_MOLD)
68 message(CHECK_START "Searching for MOLD linker")
69 find_program(MOLD_LINKER NAMES ld.mold mold)
70
71 if(MOLD_LINKER)
72 execute_process(COMMAND ${MOLD_LINKER} --version
73 RESULT_VARIABLE MOLD_VERSION_RESULT
74 OUTPUT_VARIABLE MOLD_VERSION)
75
76 if(NOT MOLD_VERSION_RESULT)
77 string(REPLACE "\n" "" MOLD_VERSION "${MOLD_VERSION}")
78 message(CHECK_PASS "found (version: ${MOLD_VERSION})")
79 message(STATUS "Using mold instead of the system default for linking.")
80 add_link_options("-fuse-ld=mold")
81 else()
82 message(CHECK_FAIL "failed")
83 endif()
84 else()
85 message(CHECK_FAIL "failed")
86 endif()
87 endif()
88
89 set(BINDIR usr/sbin)
90 set(NETDATA_RUNTIME_PREFIX "${CMAKE_INSTALL_PREFIX}")
91 # This can be changed depending on the platform with the include below
92 include(NetdataPlatform)
93 include(NetdataCompilerFlags)
94
95 set(CONFIG_H_DIR ${CMAKE_BINARY_DIR})
96 set(CONFIG_H ${CONFIG_H_DIR}/config.h)
97
98 function(netdata_windows_path_to_runtime_path output_var input_path)
99 set(_converted_path "")
100 set(_cygpath_result 1)
101
102 find_program(_cygpath_executable NAMES cygpath)
103 if(_cygpath_executable)
104 execute_process(
105 COMMAND ${_cygpath_executable} -u "${input_path}"
106 RESULT_VARIABLE _cygpath_result
107 OUTPUT_VARIABLE _converted_path
108 OUTPUT_STRIP_TRAILING_WHITESPACE
109 ERROR_QUIET)
110 endif()
111
112 if(NOT _converted_path OR NOT _cygpath_result EQUAL 0)
113 string(REPLACE "\\" "/" _converted_path "${input_path}")
114
115 if(_converted_path MATCHES "^([A-Za-z]):(.*)$")
116 string(TOLOWER "${CMAKE_MATCH_1}" _drive_letter)
117 set(_converted_path "/${_drive_letter}${CMAKE_MATCH_2}")
118 endif()
119 endif()
120
121 if(NOT _converted_path STREQUAL "")
122 string(REGEX REPLACE "/$" "" _converted_path "${_converted_path}")
123 endif()
124
125 set(${output_var} "${_converted_path}" PARENT_SCOPE)
126 endfunction()
127
128 if(OS_WINDOWS)
129 set(NETDATA_WINDOWS_PATH_PREFIX "C:\\Program Files\\Netdata" CACHE STRING
130 "Native Windows install prefix used to derive runtime paths")
131 string(REGEX REPLACE "[/\\\\]+$" "" NETDATA_WINDOWS_PATH_PREFIX "${NETDATA_WINDOWS_PATH_PREFIX}")
132 string(REPLACE "\\" "\\\\" NETDATA_WINDOWS_PATH_PREFIX_ESCAPED "${NETDATA_WINDOWS_PATH_PREFIX}")
133
134 if(NOT BUILD_FOR_PACKAGING)
135 netdata_windows_path_to_runtime_path(NETDATA_RUNTIME_PREFIX "${NETDATA_WINDOWS_PATH_PREFIX}")
136 endif()
137 endif()
138
139 if(NOT NETDATA_RUNTIME_PREFIX STREQUAL "")
140 string(REGEX REPLACE "/$" "" NETDATA_RUNTIME_PREFIX "${NETDATA_RUNTIME_PREFIX}")
141 endif()
142
143 set(CACHE_DIR "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
144 set(CONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
145 set(LIBCONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
146 set(LOG_DIR "${NETDATA_RUNTIME_PREFIX}/var/log/netdata")
147 set(PLUGINS_DIR "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata/plugins.d")
148 set(STOCK_DATA_DEST "usr/share/netdata")
149 set(STOCK_DATA_DIR "${NETDATA_RUNTIME_PREFIX}/${STOCK_DATA_DEST}")
150 set(VARLIB_DIR "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
151 set(NETDATA_BIN_DIR "${NETDATA_RUNTIME_PREFIX}/${BINDIR}")
152 if(NOT DEFINED NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR)
153 set(NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR "")
154 endif()
155
156 # A non-default value is only used when building Debian packages (/var/lib/netdata/www)
157 if(NOT DEFINED WEB_DIR)
158 set(WEB_DIR "usr/share/netdata/web")
159 else()
160 string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}")
161 endif()
162 set(WEB_DEST "${WEB_DIR}")
163 set(WEB_DIR "${NETDATA_RUNTIME_PREFIX}/${WEB_DEST}")
164
165 # This is intended to make life easier for developers who are working on one
166 # specific feature.
167 #
168 # NOTE: DO NOT USE THIS OPTION FOR PRODUCTION BUILDS.
169 option(DEFAULT_FEATURE_STATE "Specify the default state for most optional features" True)
170 mark_as_advanced(DEFAULT_FEATURE_STATE)
171
172 # High-level features
173 option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE})
174
175 if(ENABLE_ML)
176 set(NETDATA_DLIB_SOURCE_DIR "" CACHE PATH "Path to local dlib sources for building ML code")
177 endif()
178
179 option(ENABLE_DBENGINE "Enable dbengine metrics storage" True)
180 option(ENABLE_DASHBOARD "Enable local dashboard" True)
181 mark_as_advanced(ENABLE_DASHBOARD)
182
183 # Data collection plugins
184 option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE})
185 cmake_dependent_option(ENABLE_ND_MCP "Build nd-mcp stdio-to-websocket bridge for MCP integration" ${DEFAULT_FEATURE_STATE} "ENABLE_PLUGIN_GO" False)
186 option(ENABLE_PLUGIN_SCRIPTS "Enable the experimental scripts plugin (Nagios compatibility module)" ON)
187 option(ENABLE_PLUGIN_OTEL "Enable collection of OpenTelemetry metrics and logs" ${DEFAULT_FEATURE_STATE})
188 cmake_dependent_option(ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER "Enable OTel signal viewer plugin" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
189 cmake_dependent_option(ENABLE_PLUGIN_NETFLOW "Enable NetFlow/IPFIX/sFlow flow analysis plugin" False "NOT OS_WINDOWS" False)
190 option(ENABLE_PLUGIN_PYTHON "Enable metric collectors written in Python" ${DEFAULT_FEATURE_STATE})
191
192 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)
193 cmake_dependent_option(ENABLE_PLUGIN_CHARTS "Enable metric collectors written in Bash" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
194 cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
195
196 cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False)
197
198 cmake_dependent_option(ENABLE_PLUGIN_CGROUP_NETWORK "Enable Linux CGroup network usage monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
199 cmake_dependent_option(ENABLE_PLUGIN_DEBUGFS "Enable Linux DebugFS metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
200 cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
201 cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False)
202 mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS)
203 cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
204 cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_WINDOWS OR OS_FREEBSD" False)
205 cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
206 cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
207 cmake_dependent_option(ENABLE_PLUGIN_SLABINFO "Enable Linux kernel SLAB allocator monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
208 cmake_dependent_option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "Enable systemd journal log collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
209 cmake_dependent_option(ENABLE_PLUGIN_SYSTEMD_UNITS "Enable systemd units information collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
210 cmake_dependent_option(ENABLE_PLUGIN_XENSTAT "Enable Xen domain monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
211
212 cmake_dependent_option(ENABLE_PLUGIN_IBM "Enable IBM ecosystem collectors (requires CGO)" False "OS_LINUX AND CPU_X86_64" False)
213
214 # Metrics exporters
215 option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "Enable exporting to Prometheus via remote write API" ${DEFAULT_FEATURE_STATE})
216 option(ENABLE_EXPORTER_MONGODB "Enable exporting to MongoDB" ${DEFAULT_FEATURE_STATE})
217
218 # Vendoring
219 option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False)
220 option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False)
221 option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False)
222
223 # Experimental features
224 option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False)
225 mark_as_advanced(ENABLE_WEBRTC)
226
227 # Other optional functionality
228 option(ENABLE_SENTRY "Build with Sentry Native crash reporting" False)
229 mark_as_advanced(ENABLE_SENTRY)
230
231 option(BUILD_FOR_PACKAGING "Include component files for native packages" False)
232 mark_as_advanced(BUILD_FOR_PACKAGING)
233
234 cmake_dependent_option(ENABLE_LIBBACKTRACE "Use libbacktrace for stack traces in log output" True "OS_LINUX OR OS_WINDOWS" False)
235 mark_as_advanced(ENABLE_LIBBACKTRACE)
236 cmake_dependent_option(ENABLE_LIBUNWIND "Use libunwind for stack traces in log output" False "NOT ENABLE_LIBBACKTRACE" False)
237 mark_as_advanced(ENABLE_LIBUNWIND)
238
239 cmake_dependent_option(FORCE_LEGACY_LIBBPF "Force usage of libbpf 0.0.9 instead of the latest version." False "ENABLE_PLUGIN_EBPF" False)
240 mark_as_advanced(FORCE_LEGACY_LIBBPF)
241
242 cmake_dependent_option(ENABLE_NETDATA_JOURNAL_FILE_READER "Enable netdata's journal file reader implementation" False "ENABLE_PLUGIN_SYSTEMD_JOURNAL" False)
243
244 # Setup Rust/Corrosion for plugins that need it
245 if(ENABLE_NETDATA_JOURNAL_FILE_READER OR ENABLE_PLUGIN_OTEL OR ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER OR ENABLE_PLUGIN_NETFLOW)
246 include(FetchContent)
247 FetchContent_Declare(
248 Corrosion
249 GIT_REPOSITORY https://github.com/netdata/corrosion.git
250 GIT_TAG f3b91559efca32c6b54837866ef35ba98ff5b2ca # stable/v0.5
251 )
252 FetchContent_MakeAvailable(Corrosion)
253
254 # Corrosion places cargo build artifacts under ${CMAKE_BINARY_DIR}/cargo/
255 # (see Corrosion.cmake cargo_target_dir). Register it for cleanup so that
256 # `ninja clean` removes it. If a future Corrosion version changes this
257 # path, this line must be updated to match.
258 set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES "${CMAKE_BINARY_DIR}/cargo")
259
260 if(ENABLE_NETDATA_JOURNAL_FILE_READER)
261 corrosion_import_crate(MANIFEST_PATH src/crates/jf/Cargo.toml
262 CRATES journal_reader_ffi)
263 endif()
264
265 # Import crates from the main cargo workspace
266 set(_WORKSPACE_CRATES "")
267 if(ENABLE_PLUGIN_OTEL)
268 list(APPEND _WORKSPACE_CRATES otel-plugin)
269 endif()
270 if(ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER)
271 list(APPEND _WORKSPACE_CRATES otel-signal-viewer-plugin)
272 endif()
273 if(ENABLE_PLUGIN_NETFLOW)
274 list(APPEND _WORKSPACE_CRATES netflow-plugin)
275 endif()
276 if(_WORKSPACE_CRATES)
277 corrosion_import_crate(MANIFEST_PATH src/crates/Cargo.toml
278 CRATES ${_WORKSPACE_CRATES})
279 endif()
280
281 if(ENABLE_PLUGIN_OTEL)
282 if(STATIC_BUILD)
283 corrosion_add_target_rustflags(otel-plugin --cfg=tracing_unstable "-C" "target-feature=+crt-static")
284 else()
285 corrosion_add_target_rustflags(otel-plugin --cfg=tracing_unstable)
286 endif()
287 endif()
288
289 if(ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER)
290 set(OTEL_SIGNAL_VIEWER_RUSTFLAGS --cfg=tracing_unstable)
291
292 # We depend (transitively) on the `io-uring` crate which doesn't provide
293 # prebuilt bindings for 32-bit arches. Considering this is a compile-time
294 # and not a runtime dependency (because we don't use foyer's io-uring
295 # engine), we can simply skip the check.
296 if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
297 list(APPEND OTEL_SIGNAL_VIEWER_RUSTFLAGS --cfg=io_uring_skip_arch_check)
298 endif()
299
300 if(STATIC_BUILD)
301 list(APPEND OTEL_SIGNAL_VIEWER_RUSTFLAGS "-C" "target-feature=+crt-static")
302 endif()
303
304 corrosion_add_target_rustflags(otel-signal-viewer-plugin ${OTEL_SIGNAL_VIEWER_RUSTFLAGS})
305 endif()
306
307 if(ENABLE_PLUGIN_NETFLOW)
308 set(NETFLOW_PLUGIN_RUSTFLAGS "")
309
310 # We depend (transitively) on the `io-uring` crate which doesn't provide
311 # prebuilt bindings for 32-bit arches. Considering this is a compile-time
312 # and not a runtime dependency (because we don't use foyer's io-uring
313 # engine), we can simply skip the check.
314 if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
315 list(APPEND NETFLOW_PLUGIN_RUSTFLAGS --cfg=io_uring_skip_arch_check)
316 # The workspace release profile still propagates fat LTO, single-codegen-unit,
317 # and debuginfo settings through Rust dependencies on 32-bit builds. Override
318 # Cargo's release profile too so the entire dependency graph stays linkable.
319 corrosion_set_env_vars(
320 netflow-plugin
321 "CARGO_PROFILE_RELEASE_DEBUG=0"
322 "CARGO_PROFILE_RELEASE_LTO=off"
323 "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=8")
324 endif()
325
326 if(STATIC_BUILD)
327 list(APPEND NETFLOW_PLUGIN_RUSTFLAGS "-C" "target-feature=+crt-static")
328 endif()
329
330 if(NETFLOW_PLUGIN_RUSTFLAGS)
331 corrosion_add_target_rustflags(netflow-plugin ${NETFLOW_PLUGIN_RUSTFLAGS})
332 endif()
333 endif()
334 endif()
335
336 option(ENABLE_MIMALLOC "Enable mimalloc allocator" OFF)
337
338 if(ENABLE_MIMALLOC)
339 if(CMAKE_MINOR_VERSION LESS 18)
340 message(WARNING "Mimalloc disabled: Requires CMake version 3.18 or higher.")
341 set(ENABLE_MIMALLOC OFF CACHE BOOL "Enable mimalloc allocator" FORCE)
342 elseif(CMAKE_SIZEOF_VOID_P LESS 8)
343 message(WARNING "Mimalloc disabled: Only supported on 64-bit platforms.")
344 set(ENABLE_MIMALLOC OFF CACHE BOOL "Enable mimalloc allocator" FORCE)
345 elseif(OS_FREEBSD OR OS_MACOS OR OS_WINDOWS)
346 message(WARNING "Mimalloc disabled: Not supported on FreeBSD, macOS, or Windows.")
347 set(ENABLE_MIMALLOC OFF CACHE BOOL "Enable mimalloc allocator" FORCE)
348 elseif(ENABLE_ADDRESS_SANITIZER)
349 message(WARNING "Mimalloc disabled: Cannot be used with Address Sanitizer.")
350 set(ENABLE_MIMALLOC OFF CACHE BOOL "Enable mimalloc allocator" FORCE)
351 else()
352 message(STATUS "Mimalloc is enabled.")
353 endif()
354 else()
355 message(STATUS "Mimalloc is disabled.")
356 endif()
357
358 if(ENABLE_MIMALLOC)
359 function(netdata_add_mimalloc)
360 set(MI_BUILD_STATIC ON CACHE INTERNAL "")
361 set(MI_BUILD_SHARED OFF CACHE INTERNAL "")
362 set(MI_BUILD_OBJECT OFF CACHE INTERNAL "")
363 set(MI_BUILD_TESTS OFF CACHE INTERNAL "")
364
365 include(FetchContent)
366 include(NetdataFetchContentExtra)
367
368 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
369 FetchContent_Declare(mimalloc
370 GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
371 GIT_TAG 8c532c32c3c96e5ba1f2283e032f69ead8add00f
372 EXCLUDE_FROM_ALL
373 )
374 else()
375 FetchContent_Declare(mimalloc
376 GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
377 GIT_TAG 8c532c32c3c96e5ba1f2283e032f69ead8add00f
378 )
379 endif()
380
381 FetchContent_MakeAvailable_NoInstall(mimalloc)
382 endfunction()
383
384 netdata_add_mimalloc()
385 endif()
386
387 option(ENABLE_JEMALLOC "Disable jemalloc allocator" OFF)
388
389 if(ENABLE_JEMALLOC)
390 pkg_check_modules(JEMALLOC QUIET jemalloc)
391 if(JEMALLOC_FOUND)
392 # Check if jemalloc has arena API
393 cmake_push_check_state()
394 set(CMAKE_REQUIRED_INCLUDES ${JEMALLOC_INCLUDE_DIRS})
395 set(CMAKE_REQUIRED_LIBRARIES ${JEMALLOC_LIBRARIES})
396 check_c_source_compiles("
397 #include <jemalloc/jemalloc.h>
398 int main() {
399 unsigned narenas;
400 size_t sz = sizeof(narenas);
401 mallctl(\"arenas.narenas\", &narenas, &sz, NULL, 0);
402 return 0;
403 }
404 " HAVE_JEMALLOC_ARENA_API)
405 cmake_pop_check_state()
406
407 if(HAVE_JEMALLOC_ARENA_API)
408 set(ENABLE_JEMALLOC ON CACHE BOOL "Enable jemalloc allocator" FORCE)
409 message(STATUS "Jemalloc found with arena API support - enabling")
410 else()
411 if(ENABLE_JEMALLOC)
412 message(FATAL_ERROR "Jemalloc was found but does not have arena API support")
413 endif()
414 message(STATUS "Jemalloc found but does not have arena API support - disabling")
415 endif()
416 else()
417 if(ENABLE_JEMALLOC)
418 message(FATAL_ERROR "Jemalloc support was explicitly enabled but jemalloc was not found")
419 endif()
420 message(STATUS "Jemalloc not found - disabling")
421 endif()
422 endif()
423
424 if(ENABLE_PLUGIN_GO OR ENABLE_PLUGIN_IBM OR ENABLE_PLUGIN_SCRIPTS OR ENABLE_PLUGIN_NETFLOW)
425 include(NetdataGoTools)
426
427 find_min_go_version("${CMAKE_SOURCE_DIR}/src/go")
428
429 find_package(Go "${MIN_GO_VERSION}" REQUIRED)
430 endif()
431
432 if(ENABLE_PLUGIN_GO OR ENABLE_PLUGIN_SCRIPTS)
433 set(NEED_NDSUDO TRUE)
434 else()
435 set(NEED_NDSUDO FALSE)
436 endif()
437
438 if(ENABLE_WEBRTC)
439 include(FetchContent)
440 include(NetdataFetchContentExtra)
441
442 # ignore debhelper
443 set(FETCHCONTENT_FULLY_DISCONNECTED Off)
444
445 set(PREFER_SYSTEM_LIB True)
446 set(NO_MEDIA True)
447 set(NO_WEBSOCKET True)
448
449 set(HAVE_LIBDATACHANNEL True)
450
451 FetchContent_Declare(libdatachannel
452 GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
453 GIT_TAG v0.20.1
454 CMAKE_ARGS ${NETDATA_PROPAGATE_TOOLCHAIN_ARGS}
455 )
456 FetchContent_MakeAvailable(libdatachannel)
457 endif()
458
459 include(NetdataProtobuf)
460
461 if(ENABLE_BUNDLED_PROTOBUF)
462 netdata_bundle_protobuf()
463 endif()
464
465 set(PKG_FILES_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/pkg-files")
466
467 if(ENABLE_PLUGIN_EBPF)
468 include(NetdataLibBPF)
469 include(NetdataEBPFCORE)
470
471 if(NOT OS_LINUX)
472 message(FATAL_ERROR "The eBPF plugin is not supported on non-Linux systems")
473 endif()
474
475 netdata_bundle_libbpf()
476 netdata_fetch_ebpf_co_re()
477 endif()
478
479 pkg_check_modules(CURL libcurl>=7.21 REQUIRED IMPORTED_TARGET)
480 set(HAVE_LIBCURL TRUE)
481
482 #
483 # Libm
484 #
485
486 # checks link with cmake required libs
487 cmake_policy(SET CMP0075 NEW)
488
489 include(CheckFunctionExists)
490
491 check_function_exists(log10 HAVE_LOG10)
492 if(NOT HAVE_LOG10)
493 unset(HAVE_LOG10 CACHE)
494 list(APPEND CMAKE_REQUIRED_LIBRARIES m)
495 check_function_exists(log10 HAVE_LOG10)
496 if(HAVE_LOG10)
497 set(LINK_LIBM True)
498 else()
499 message(FATAL_ERROR "Can not use log10 with/without libm.")
500 endif()
501 endif()
502
503 #
504 # Custom Modules
505 #
506
507 include(NetdataJSONC)
508 include(NetdataYAML)
509 include(NetdataBacktrace)
510 include(NetdataDlib)
511
512 if(ENABLE_LEGACY_EBPF_PROGRAMS)
513 include(NetdataEBPFLegacy)
514 endif()
515
516 if(ENABLE_SENTRY)
517 include(NetdataSentry)
518 endif()
519
520 #
521 # Checks from custom modules
522 #
523
524 netdata_detect_jsonc()
525 netdata_detect_libyaml()
526
527 if(ENABLE_LEGACY_EBPF_PROGRAMS)
528 netdata_fetch_legacy_ebpf_code()
529 endif()
530
531 if(ENABLE_SENTRY)
532 netdata_bundle_sentry()
533 endif()
534
535 if(ENABLE_ML)
536 netdata_bundle_dlib()
537 endif()
538
539 #
540 # check include files
541 #
542
543 include(CheckIncludeFile)
544
545 check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
546 check_include_file("resolv.h" HAVE_RESOLV_H)
547 check_include_file("netdb.h" HAVE_NETDB_H)
548 check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
549 check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
550 check_include_file("sys/vfs.h" HAVE_SYS_VFS_H)
551 check_include_file("sys/statfs.h" HAVE_SYS_STATFS_H)
552 check_include_file("linux/magic.h" HAVE_LINUX_MAGIC_H)
553 check_include_file("sys/mount.h" HAVE_SYS_MOUNT_H)
554 check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H)
555 check_include_file("inttypes.h" HAVE_INTTYPES_H)
556 check_include_file("stdint.h" HAVE_STDINT_H)
557 check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
558 check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H)
559 check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
560 check_include_file("grp.h" HAVE_GRP_H)
561 check_include_file("pwd.h" HAVE_PWD_H)
562 check_include_file("net/if.h" HAVE_NET_IF_H)
563 check_include_file("poll.h" HAVE_POLL_H)
564 check_include_file("syslog.h" HAVE_SYSLOG_H)
565 check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
566 check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
567 check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
568 check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
569 check_include_file("sys/un.h" HAVE_SYS_UN_H)
570 check_include_file("spawn.h" HAVE_SPAWN_H)
571
572 #
573 # check symbols
574 #
575
576 include(CheckSymbolExists)
577 check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
578 check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
579 check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
580 check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
581 check_symbol_exists(finite "math.h" HAVE_FINITE)
582 check_symbol_exists(isfinite "math.h" HAVE_ISFINITE)
583 check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM)
584 check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV)
585
586 check_function_exists(setresuid HAVE_SETRESUID)
587 check_function_exists(setresgid HAVE_SETRESGID)
588
589 check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP)
590 check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
591 check_function_exists(gettid HAVE_GETTID)
592 check_function_exists(waitid HAVE_WAITID)
593 check_function_exists(nice HAVE_NICE)
594 check_function_exists(recvmmsg HAVE_RECVMMSG)
595 check_function_exists(getpriority HAVE_GETPRIORITY)
596 check_function_exists(setenv HAVE_SETENV)
597 check_function_exists(strndup HAVE_STRNDUP)
598
599 check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER)
600 check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER)
601 check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
602 check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
603
604 check_function_exists(close_range HAVE_CLOSE_RANGE)
605 check_function_exists(backtrace HAVE_BACKTRACE)
606
607 check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
608 check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM)
609 check_function_exists(getrandom HAVE_GETRANDOM)
610 check_function_exists(sysinfo HAVE_SYSINFO)
611
612 check_function_exists(timegm HAVE_TIMEGM)
613 check_function_exists(tzalloc HAVE_TZALLOC)
614 check_function_exists(localtime_rz HAVE_LOCALTIME_RZ)
615 check_function_exists(tzfree HAVE_TZFREE)
616
617 if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
618 # -fno-omit-frame-pointer = add frame pointers to all functions
619 # -funwind-tables = generate unwind tables for all functions
620 # -fasynchronous-unwind-tables = the unwind table generated is precise at instruction boundary, instead of function boundary
621 add_compile_options(-fno-omit-frame-pointer -funwind-tables -fasynchronous-unwind-tables)
622 add_link_options(-rdynamic)
623 message(STATUS "Added compiler and linker flags for better stack trace support")
624 endif()
625
626 if(ENABLE_LIBBACKTRACE)
627 netdata_bundle_libbacktrace()
628 endif()
629
630 #
631 # check source compilation
632 #
633
634 include(CheckCSourceCompiles)
635 include(CheckCXXSourceCompiles)
636
637 check_c_source_compiles("
638 #include <time.h>
639 int main(void) {
640 struct tm t;
641 (void)t.tm_gmtoff;
642 return 0;
643 }
644 " HAVE_TM_GMTOFF)
645
646 cmake_push_check_state()
647 set(CMAKE_REQUIRED_LIBRARIES pthread)
648 check_c_source_compiles("
649 #define _GNU_SOURCE
650 #include <pthread.h>
651 int main() {
652 char name[16];
653 pthread_t thread = pthread_self();
654 return pthread_getname_np(thread, name, sizeof(name));
655 }
656 " HAVE_PTHREAD_GETNAME_NP)
657 cmake_pop_check_state()
658
659 check_c_source_compiles("
660 #include <stdio.h>
661 #define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u')
662 int main() {
663 char type = mytype(0);
664 return 0;
665 }
666 " HAVE_C__GENERIC)
667
668 check_c_source_compiles("
669 #include <malloc.h>
670 int main() {
671 mallopt(M_ARENA_MAX, 1);
672 mallopt(M_PERTURB, 0x5A);
673 return 0;
674 }
675 " HAVE_C_MALLOPT)
676
677 check_c_source_compiles("
678 #include <malloc.h>
679 int main() {
680 malloc_trim(0);
681 return 0;
682 }
683 " HAVE_C_MALLOC_TRIM)
684
685 check_c_source_compiles("
686 #include <malloc.h>
687 int main() {
688 malloc_info(0, stdout);
689 return 0;
690 }
691 " HAVE_C_MALLOC_INFO)
692
693 check_c_source_compiles("
694 #include <malloc.h>
695 int main() {
696 struct mallinfo2 m = mallinfo2();
697 return 0;
698 }
699 " HAVE_C_MALLINFO2)
700
701 check_c_source_compiles("
702 #define _GNU_SOURCE
703 #include <stdio.h>
704 #include <sys/socket.h>
705 int main() {
706 accept4(0, NULL, NULL, 0);
707 return 0;
708 }
709 " HAVE_ACCEPT4)
710
711 check_c_source_compiles("
712 #define _GNU_SOURCE
713 #include <string.h>
714 int main() {
715 char x = *strerror_r(0, &x, sizeof(x)); return 0;
716 }
717 " STRERROR_R_CHAR_P)
718
719 check_c_source_compiles("
720 #ifndef _GNU_SOURCE
721 #define _GNU_SOURCE
722 #endif
723 #include <sched.h>
724 int main() {
725 setns(0, 0); return 0;
726 }
727 " HAVE_SETNS)
728
729 check_cxx_source_compiles("
730 int main() {
731 __atomic_load_8(nullptr, 0);
732 return 0;
733 }
734 " HAVE_BUILTIN_ATOMICS)
735
736 check_cxx_source_compiles("
737 #include <stdint.h>
738 int main(void) {
739 uint64_t a;
740 __sync_add_and_fetch(&a, 1);
741 return 0;
742 }
743 " ARCH_SUPPORTS_64BIT_ATOMICS)
744
745 check_c_source_compiles("
746 void my_printf(char const *s, ...) __attribute__((format(gnu_printf, 1, 2)));
747 int main() { return 0; }
748 " HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF FAIL_REGEX "warning:")
749
750 check_c_source_compiles("
751 void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
752 int main() { return 0; }
753 " HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF FAIL_REGEX "warning:")
754
755 check_c_source_compiles("
756 #include <stdio.h>
757 #include <stdlib.h>
758 #include <unistd.h>
759 void* my_alloc(size_t size) __attribute__((malloc));
760 int main() {
761 void *x = my_alloc(1);
762 free(x);
763 return 0;
764 }
765 void* my_alloc(size_t size) {
766 void *ret = malloc(size);
767 if(!ret) exit(1);
768 return ret;
769 }
770 " HAVE_FUNC_ATTRIBUTE_MALLOC)
771
772 check_c_source_compiles("
773 void my_function() __attribute__((noinline));
774 int main() { my_function(); return 0; }
775 void my_function() { ; }
776 " HAVE_FUNC_ATTRIBUTE_NOINLINE)
777
778 check_c_source_compiles("
779 #include <stdlib.h>
780 void my_exit_function() __attribute__((noreturn));
781 int main() {
782 my_exit_function(); // Call the noreturn function
783 return 0;
784 }
785 void my_exit_function() {
786 exit(1);
787 }
788 " HAVE_FUNC_ATTRIBUTE_NORETURN)
789
790 check_c_source_compiles("
791 #include <stdio.h>
792 #include <stdlib.h>
793 #include <unistd.h>
794 void* my_alloc(size_t size) __attribute__((returns_nonnull));
795 int main() {
796 void* ptr = my_alloc(10);
797 free(ptr);
798 return 0;
799 }
800 void* my_alloc(size_t size) {
801 void *ret = malloc(size);
802 if(!ret) exit(1);
803 return ret;
804 }
805 " HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL)
806
807 check_c_source_compiles("
808 int my_function() __attribute__((warn_unused_result));
809 int main() {
810 return my_function();
811 }
812 int my_function() {
813 return 1;
814 }
815 " HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT)
816
817 # Windows MSVCRT random number generator
818 # used only when compiling natively (not MSYS/CYGWIN)
819 check_c_source_compiles("
820 #define _CRT_RAND_S
821 #include <stdlib.h>
822 int main() {
823 unsigned int x;
824 return rand_s(&x);
825 }
826 " HAVE_RAND_S)
827
828 if(OS_FREEBSD OR OS_MACOS)
829 set(HAVE_BUILTIN_ATOMICS True)
830 endif()
831
832 # openssl/crypto
833 pkg_check_modules(TLS IMPORTED_TARGET openssl)
834
835 if(NOT TARGET PkgConfig::TLS)
836 if(OS_MACOS)
837 execute_process(COMMAND
838 brew --prefix --installed openssl
839 RESULT_VARIABLE BREW_OPENSSL
840 OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
841 OUTPUT_STRIP_TRAILING_WHITESPACE)
842
843 if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
844 message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
845 endif()
846
847 add_library(PkgConfig::CRYPTO IMPORTED)
848 set_target_properties(PkgConfig::CRYPTO
849 IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libcrypto.dylib
850 INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
851
852 add_library(PkgConfig::TLS IMPORTED)
853 set_target_properties(PkgConfig::TLS
854 IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libssl.dylib
855 INTERFACE_LINK_LIBRARIES PkgConfig::CRYPTO
856 INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
857 else()
858 message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
859 endif()
860 else()
861 pkg_check_modules(CRYPTO IMPORTED_TARGET REQUIRED libcrypto)
862 endif()
863
864 netdata_detect_protobuf()
865
866 if(OS_LINUX)
867 include(NetdataDetectSystemd)
868 detect_systemd()
869 endif()
870
871 #
872 # source files
873 #
874
875 set(LIBJUDY_PREV_FILES
876 src/libnetdata/libjudy/vendored/JudyL/JudyLPrev.c
877 src/libnetdata/libjudy/vendored/JudyL/JudyLPrevEmpty.c
878 )
879
880 set(LIBJUDY_NEXT_FILES
881 src/libnetdata/libjudy/vendored/JudyL/JudyLNext.c
882 src/libnetdata/libjudy/vendored/JudyL/JudyLNextEmpty.c
883 )
884
885 set(LIBJUDY_SOURCES
886 src/libnetdata/libjudy/vendored/Judy.h
887 src/libnetdata/libjudy/vendored/JudyCommon/JudyMalloc.c
888 src/libnetdata/libjudy/vendored/JudyCommon/JudyPrivate.h
889 src/libnetdata/libjudy/vendored/JudyCommon/JudyPrivate1L.h
890 src/libnetdata/libjudy/vendored/JudyCommon/JudyPrivateBranch.h
891 src/libnetdata/libjudy/vendored/JudyL/JudyL.h
892 src/libnetdata/libjudy/vendored/JudyL/JudyLByCount.c
893 src/libnetdata/libjudy/vendored/JudyL/JudyLCascade.c
894 src/libnetdata/libjudy/vendored/JudyL/JudyLCount.c
895 src/libnetdata/libjudy/vendored/JudyL/JudyLCreateBranch.c
896 src/libnetdata/libjudy/vendored/JudyL/JudyLDecascade.c
897 src/libnetdata/libjudy/vendored/JudyL/JudyLDel.c
898 src/libnetdata/libjudy/vendored/JudyL/JudyLFirst.c
899 src/libnetdata/libjudy/vendored/JudyL/JudyLFreeArray.c
900 src/libnetdata/libjudy/vendored/JudyL/j__udyLGet.c
901 src/libnetdata/libjudy/vendored/JudyL/JudyLGet.c
902 src/libnetdata/libjudy/vendored/JudyL/JudyLInsArray.c
903 src/libnetdata/libjudy/vendored/JudyL/JudyLIns.c
904 src/libnetdata/libjudy/vendored/JudyL/JudyLInsertBranch.c
905 src/libnetdata/libjudy/vendored/JudyL/JudyLMallocIF.c
906 src/libnetdata/libjudy/vendored/JudyL/JudyLMemActive.c
907 src/libnetdata/libjudy/vendored/JudyL/JudyLMemUsed.c
908 src/libnetdata/libjudy/vendored/JudyL/JudyLTables.c
909 src/libnetdata/libjudy/vendored/JudyHS/JudyHS.c
910 ${LIBJUDY_PREV_FILES}
911 ${LIBJUDY_NEXT_FILES}
912 )
913
914 set(INICFG_FILES
915 src/libnetdata/inicfg/inicfg.c
916 src/libnetdata/inicfg/inicfg.h
917 src/libnetdata/inicfg/inicfg_internals.h
918 src/libnetdata/inicfg/inicfg_exporters.c
919 src/libnetdata/inicfg/inicfg_conf_file.c
920 src/libnetdata/inicfg/inicfg_cleanup.c
921 src/libnetdata/inicfg/inicfg_sections.c
922 src/libnetdata/inicfg/inicfg_options.c
923 src/libnetdata/inicfg/inicfg_migrate.c
924 src/libnetdata/inicfg/inicfg_traversal.c
925 src/libnetdata/inicfg/inicfg_api.c
926 src/libnetdata/inicfg/dyncfg.c
927 src/libnetdata/inicfg/dyncfg.h
928 )
929
930 set(CONFIG_FILES
931 src/libnetdata/config/config.h
932 )
933
934 set(LIBNETDATA_FILES
935 ${CONFIG_H}
936 src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.c
937 src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h
938 src/libnetdata/aral/aral.c
939 src/libnetdata/aral/aral.h
940 src/libnetdata/avl/avl.c
941 src/libnetdata/avl/avl.h
942 src/libnetdata/bitmap/bitmap64.h
943 src/libnetdata/buffer/buffer.c
944 src/libnetdata/buffer/buffer.h
945 src/libnetdata/buffer/functions_fields.c
946 src/libnetdata/buffer/functions_fields.h
947 src/libnetdata/ringbuffer/ringbuffer.c
948 src/libnetdata/ringbuffer/ringbuffer.h
949 src/libnetdata/circular_buffer/circular_buffer.c
950 src/libnetdata/circular_buffer/circular_buffer.h
951 src/libnetdata/clocks/clocks.c
952 src/libnetdata/clocks/clocks.h
953 src/libnetdata/completion/completion.c
954 src/libnetdata/completion/completion.h
955 src/libnetdata/datetime/iso8601.c
956 src/libnetdata/datetime/iso8601.h
957 src/libnetdata/datetime/rfc7231.c
958 src/libnetdata/datetime/rfc7231.h
959 src/libnetdata/datetime/rfc3339.c
960 src/libnetdata/datetime/rfc3339.h
961 src/libnetdata/dictionary/dictionary.c
962 src/libnetdata/dictionary/dictionary-debug.c
963 src/libnetdata/dictionary/dictionary-debug.h
964 src/libnetdata/dictionary/dictionary.h
965 src/libnetdata/eval/eval-parser-legacy.c
966 src/libnetdata/eval/eval-evaluate.c
967 src/libnetdata/eval/eval-utils.c
968 src/libnetdata/eval/eval.h
969 src/libnetdata/eval/eval-internal.h
970 src/libnetdata/eval/eval-unittest.c
971 src/libnetdata/eval/eval-unittest-hardcoding.c
972 src/libnetdata/eval/re2c_lemon/lexer.c
973 src/libnetdata/eval/re2c_lemon/parser.c
974 src/libnetdata/eval/re2c_lemon/parser_wrapper.c
975 src/libnetdata/facets/facets.c
976 src/libnetdata/facets/facets.h
977 src/libnetdata/functions_evloop/functions_evloop.c
978 src/libnetdata/functions_evloop/functions_evloop.h
979 src/libnetdata/gorilla/gorilla.cc
980 src/libnetdata/gorilla/gorilla.h
981 src/libnetdata/inlined.h
982 src/libnetdata/json/json.c
983 src/libnetdata/json/json.h
984 src/libnetdata/json/json-keys.c
985 src/libnetdata/json/json-keys.h
986 src/libnetdata/json/vendored/jsmn.c
987 src/libnetdata/json/vendored/jsmn.h
988 src/libnetdata/yaml/yaml.c
989 src/libnetdata/yaml/yaml.h
990 src/libnetdata/yaml/yaml-unittest.c
991 src/libnetdata/yaml/yaml-comprehensive-unittest.c
992 src/libnetdata/libnetdata.c
993 src/libnetdata/libnetdata.h
994 src/libnetdata/line_splitter/line_splitter.c
995 src/libnetdata/line_splitter/line_splitter.h
996 src/libnetdata/libnetdata.h
997 src/libnetdata/linked_lists/linked_lists.h
998 src/libnetdata/locks/locks.c
999 src/libnetdata/locks/locks.h
1000 src/libnetdata/log/systemd-journal-helpers.c
1001 src/libnetdata/log/systemd-journal-helpers.h
1002 src/libnetdata/log/nd_log.c
1003 src/libnetdata/log/nd_log.h
1004 src/libnetdata/os/os.c
1005 src/libnetdata/os/os.h
1006 src/libnetdata/os/ci.c
1007 src/libnetdata/os/ci.h
1008 src/libnetdata/os/byteorder.h
1009 src/libnetdata/onewayalloc/onewayalloc.c
1010 src/libnetdata/onewayalloc/onewayalloc.h
1011 src/libnetdata/procfile/procfile.c
1012 src/libnetdata/procfile/procfile.h
1013 src/libnetdata/query_progress/progress.c
1014 src/libnetdata/query_progress/progress.h
1015 src/libnetdata/socket/security.c
1016 src/libnetdata/socket/security.h
1017 src/libnetdata/simple_hashtable/simple_hashtable.h
1018 src/libnetdata/simple_hashtable/simple_hashtable_undef.h
1019 src/libnetdata/simple_pattern/simple_pattern.c
1020 src/libnetdata/simple_pattern/simple_pattern.h
1021 src/libnetdata/socket/socket.c
1022 src/libnetdata/socket/socket.h
1023 src/libnetdata/statistical/statistical.c
1024 src/libnetdata/statistical/statistical.h
1025 src/libnetdata/storage_number/storage_number.c
1026 src/libnetdata/storage_number/storage_number.h
1027 src/libnetdata/string/string.c
1028 src/libnetdata/string/string.h
1029 src/libnetdata/threads/threads.c
1030 src/libnetdata/threads/threads.h
1031 src/libnetdata/url/url.c
1032 src/libnetdata/url/url.h
1033 src/libnetdata/uuid/uuid.c
1034 src/libnetdata/uuid/uuid.h
1035 src/libnetdata/string/utf8.h
1036 src/libnetdata/worker_utilization/worker_utilization.c
1037 src/libnetdata/worker_utilization/worker_utilization.h
1038 src/libnetdata/user-auth/http-access.c
1039 src/libnetdata/user-auth/http-access.h
1040 src/libnetdata/user-auth/user-auth.c
1041 src/libnetdata/user-auth/user-auth.h
1042 src/libnetdata/http/http_defs.c
1043 src/libnetdata/http/http_defs.h
1044 src/libnetdata/http/content_type.c
1045 src/libnetdata/http/content_type.h
1046 src/libnetdata/json/json-c-parser-inline.h
1047 src/libnetdata/template-enum.h
1048 src/libnetdata/dictionary/dictionary-internals.h
1049 src/libnetdata/dictionary/dictionary-unittest.c
1050 src/libnetdata/dictionary/thread-cache.c
1051 src/libnetdata/dictionary/thread-cache.h
1052 src/libnetdata/dictionary/dictionary-traversal.c
1053 src/libnetdata/dictionary/dictionary-statistics.h
1054 src/libnetdata/dictionary/dictionary-locks.h
1055 src/libnetdata/dictionary/dictionary-refcount.h
1056 src/libnetdata/dictionary/dictionary-hashtable.h
1057 src/libnetdata/dictionary/dictionary-item.h
1058 src/libnetdata/dictionary/dictionary-callbacks.h
1059 src/libnetdata/storage-point.h
1060 src/libnetdata/parsers/parsers.h
1061 src/libnetdata/parsers/duration.c
1062 src/libnetdata/parsers/duration-unittest.c
1063 src/libnetdata/os/gettid.c
1064 src/libnetdata/os/gettid.h
1065 src/libnetdata/os/adjtimex.c
1066 src/libnetdata/os/adjtimex.h
1067 src/libnetdata/os/setresuid.c
1068 src/libnetdata/os/setresuid.h
1069 src/libnetdata/os/setresgid.c
1070 src/libnetdata/os/setresgid.h
1071 src/libnetdata/os/getgrouplist.c
1072 src/libnetdata/os/getgrouplist.h
1073 src/libnetdata/os/get_pid_max.c
1074 src/libnetdata/os/get_pid_max.h
1075 src/libnetdata/os/os-freebsd-wrappers.c
1076 src/libnetdata/os/os-freebsd-wrappers.h
1077 src/libnetdata/os/os-macos-wrappers.c
1078 src/libnetdata/os/os-macos-wrappers.h
1079 src/libnetdata/os/os-windows-wrappers.c
1080 src/libnetdata/os/os-windows-wrappers.h
1081 src/libnetdata/os/get_system_cpus.c
1082 src/libnetdata/os/get_system_cpus.h
1083 src/libnetdata/os/sleep.c
1084 src/libnetdata/os/sleep.h
1085 src/libnetdata/os/uuid_generate.c
1086 src/libnetdata/os/uuid_generate.h
1087 src/libnetdata/os/setenv.c
1088 src/libnetdata/os/setenv.h
1089 src/libnetdata/os/strndup.c
1090 src/libnetdata/os/strndup.h
1091 src/libnetdata/os/windows-wmi/windows-wmi.c
1092 src/libnetdata/os/windows-wmi/windows-wmi.h
1093 src/libnetdata/os/windows-wmi/windows-wmi-GetDiskDriveInfo.c
1094 src/libnetdata/os/windows-wmi/windows-wmi-GetDiskDriveInfo.h
1095 src/libnetdata/os/windows-perflib/perflib.c
1096 src/libnetdata/os/windows-perflib/perflib.h
1097 src/libnetdata/os/windows-perflib/perflib-names.c
1098 src/libnetdata/os/windows-perflib/perflib-dump.c
1099 src/libnetdata/os/system-maps/cached-uid-username.c
1100 src/libnetdata/os/system-maps/cached-uid-username.h
1101 src/libnetdata/os/system-maps/cached-sid-username.c
1102 src/libnetdata/os/system-maps/cached-sid-username.h
1103 src/libnetdata/os/system-maps/cached-gid-groupname.c
1104 src/libnetdata/os/system-maps/cached-gid-groupname.h
1105 src/libnetdata/os/system-maps/cache-host-users-and-groups.c
1106 src/libnetdata/os/system-maps/cache-host-users-and-groups.h
1107 src/libnetdata/spawn_server/spawn_server_nofork.c
1108 src/libnetdata/spawn_server/spawn_server.h
1109 src/libnetdata/spawn_server/spawn_popen.c
1110 src/libnetdata/spawn_server/spawn_popen.h
1111 src/libnetdata/spawn_server/spawn_server_windows.c
1112 src/libnetdata/spawn_server/spawn_server_internals.h
1113 src/libnetdata/spawn_server/spawn_server_libuv.c
1114 src/libnetdata/spawn_server/spawn_server_posix.c
1115 src/libnetdata/spawn_server/spawn_library.c
1116 src/libnetdata/spawn_server/spawn_library.h
1117 src/libnetdata/os/close_range.c
1118 src/libnetdata/os/close_range.h
1119 src/libnetdata/os/setproctitle.c
1120 src/libnetdata/os/setproctitle.h
1121 src/libnetdata/paths/paths.c
1122 src/libnetdata/paths/paths.h
1123 src/libnetdata/json/json-c-parser-inline.c
1124 src/libnetdata/json/json-c-parser-unittest.c
1125 src/libnetdata/parsers/duration.h
1126 src/libnetdata/parsers/timeframe.c
1127 src/libnetdata/parsers/timeframe.h
1128 src/libnetdata/parsers/size.c
1129 src/libnetdata/parsers/size.h
1130 src/libnetdata/libjudy/judy-malloc.c
1131 src/libnetdata/libjudy/judy-malloc.h
1132 src/libnetdata/facets/logs_query_status.h
1133 src/libnetdata/os/timestamps.c
1134 src/libnetdata/os/timestamps.h
1135 src/libnetdata/parsers/entries.c
1136 src/libnetdata/parsers/entries.h
1137 src/libnetdata/sanitizers/chart_id_and_name.c
1138 src/libnetdata/sanitizers/chart_id_and_name.h
1139 src/libnetdata/sanitizers/utf8-sanitizer.c
1140 src/libnetdata/sanitizers/utf8-sanitizer.h
1141 src/libnetdata/sanitizers/utf8-sanitizer-unittest.c
1142 src/libnetdata/sanitizers/sanitizers.h
1143 src/libnetdata/sanitizers/sanitizers-labels.c
1144 src/libnetdata/sanitizers/sanitizers-labels.h
1145 src/libnetdata/sanitizers/sanitizers-functions.c
1146 src/libnetdata/sanitizers/sanitizers-functions.h
1147 src/libnetdata/sanitizers/sanitizers-pluginsd.c
1148 src/libnetdata/sanitizers/sanitizers-pluginsd.h
1149 src/libnetdata/log/nd_log-internals.c
1150 src/libnetdata/log/nd_log-internals.h
1151 src/libnetdata/log/nd_log_limit.c
1152 src/libnetdata/log/nd_log_limit.h
1153 src/libnetdata/log/nd_log-config.c
1154 src/libnetdata/log/nd_log-init.c
1155 src/libnetdata/log/nd_log-to-syslog.c
1156 src/libnetdata/log/nd_log-to-systemd-journal.c
1157 src/libnetdata/log/nd_log-annotators.c
1158 src/libnetdata/log/nd_log-field-formatters.c
1159 src/libnetdata/log/nd_log-format-logfmt.c
1160 src/libnetdata/log/nd_log-format-json.c
1161 src/libnetdata/log/nd_log-to-file.c
1162 src/libnetdata/log/nd_log-to-windows-events.c
1163 src/libnetdata/string/utf8.c
1164 src/libnetdata/spawn_server/log-forwarder.c
1165 src/libnetdata/spawn_server/log-forwarder.h
1166 src/libnetdata/log/nd_log-common.h
1167 src/libnetdata/log/nd_log-to-windows-common.h
1168 src/libnetdata/common.h
1169 src/libnetdata/libnetdata-base.h
1170 src/libnetdata/libnetdata-types.h
1171 src/libnetdata/libnetdata-platform-fwd.h
1172 src/libnetdata/xxHash/xxhash.h
1173 src/libnetdata/os/random.c
1174 src/libnetdata/os/random.h
1175 src/libnetdata/socket/nd-sock.c
1176 src/libnetdata/socket/nd-sock.h
1177 src/libnetdata/socket/listen-sockets.c
1178 src/libnetdata/socket/listen-sockets.h
1179 src/libnetdata/socket/poll-events.c
1180 src/libnetdata/socket/poll-events.h
1181 src/libnetdata/socket/connect-to.c
1182 src/libnetdata/socket/connect-to.h
1183 src/libnetdata/socket/socket-peers.c
1184 src/libnetdata/socket/socket-peers.h
1185 src/libnetdata/libjudy/judyl-typed.h
1186 src/libnetdata/os/system_memory.c
1187 src/libnetdata/os/system_memory.h
1188 src/libnetdata/socket/nd-poll.c
1189 src/libnetdata/socket/nd-poll.h
1190 src/libnetdata/locks/spinlock.c
1191 src/libnetdata/locks/spinlock.h
1192 src/libnetdata/locks/rw-spinlock.c
1193 src/libnetdata/locks/rw-spinlock.h
1194 src/libnetdata/locks/rw-spinlock-unittest.c
1195 src/libnetdata/atomics/atomic_flags.h
1196 src/libnetdata/atomics/atomics.h
1197 src/libnetdata/locks/waitq.c
1198 src/libnetdata/locks/waitq.h
1199 src/libnetdata/object-state/object-state.c
1200 src/libnetdata/object-state/object-state.h
1201 src/libnetdata/uuid/uuidmap.c
1202 src/libnetdata/uuid/uuidmap.h
1203 src/libnetdata/atomics/refcount.h
1204 src/libnetdata/log/nd_log-fatal.h
1205 src/libnetdata/locks/benchmark.c
1206 src/libnetdata/locks/benchmark.h
1207 src/libnetdata/locks/benchmark-rw.c
1208 src/libnetdata/locks/benchmark-rw.h
1209 src/libnetdata/memory/nd-mallocz.c
1210 src/libnetdata/memory/nd-mallocz.h
1211 src/libnetdata/memory/nd-mmap.c
1212 src/libnetdata/memory/nd-mmap.h
1213 src/libnetdata/memory/alignment.h
1214 src/libnetdata/os/get_system_pagesize.c
1215 src/libnetdata/os/get_system_pagesize.h
1216 src/libnetdata/os/hostname.c
1217 src/libnetdata/os/hostname.h
1218 src/libnetdata/exit/exit_initiated.c
1219 src/libnetdata/exit/exit_initiated.h
1220 src/libnetdata/os/disk_space.c
1221 src/libnetdata/os/disk_space.h
1222 src/libnetdata/os/file_metadata.c
1223 src/libnetdata/os/file_metadata.h
1224 src/libnetdata/os/process_path.c
1225 src/libnetdata/os/process_path.h
1226 src/libnetdata/os/boottime.c
1227 src/libnetdata/os/boottime.h
1228 src/libnetdata/os/boot_id.c
1229 src/libnetdata/os/boot_id.h
1230 src/libnetdata/os/run_dir.c
1231 src/libnetdata/os/run_dir.h
1232 src/libnetdata/os/file_lock.c
1233 src/libnetdata/os/file_lock.h
1234 src/libnetdata/os/mmap_limit.c
1235 src/libnetdata/os/mmap_limit.h
1236 src/libnetdata/signals/signals.c
1237 src/libnetdata/signals/signals.h
1238 src/libnetdata/runtime-paths/runtime-paths.c
1239 src/libnetdata/runtime-paths/runtime-paths.h
1240 src/libnetdata/os/machine_id.c
1241 src/libnetdata/os/machine_id.h
1242 src/libnetdata/os/process_memory.c
1243 src/libnetdata/os/process_memory.h
1244 src/libnetdata/os/dir_size.c
1245 src/libnetdata/os/dir_size.h
1246 src/libnetdata/signals/signal-code.c
1247 src/libnetdata/signals/signal-code.h
1248 )
1249
1250 if(OS_WINDOWS)
1251 set(LIBNETDATA_WIN_FILES
1252 src/libnetdata/os/windows-api/windows_api.c
1253 src/libnetdata/os/windows-api/windows_api.h
1254 )
1255
1256 list(APPEND LIBNETDATA_FILES ${LIBNETDATA_WIN_FILES})
1257 endif()
1258
1259 if(OS_LINUX OR OS_WINDOWS)
1260 list(APPEND LIBNETDATA_FILES
1261 src/libnetdata/netipc/netipc_netdata.c
1262 src/libnetdata/netipc/netipc_netdata.h
1263 )
1264 endif()
1265
1266 if(NOT OS_FREEBSD)
1267 set(LIBNETDATA_STACKTRACE_FILES
1268 src/libnetdata/stacktrace/stacktrace.h
1269 src/libnetdata/stacktrace/stacktrace-common.h
1270 src/libnetdata/stacktrace/stacktrace-common.c
1271 src/libnetdata/stacktrace/stacktrace-array.h
1272 src/libnetdata/stacktrace/stacktrace-array.c
1273 src/libnetdata/stacktrace/stacktrace-libbacktrace.c
1274 src/libnetdata/stacktrace/stacktrace-libunwind.c
1275 src/libnetdata/stacktrace/stacktrace-backtrace.c
1276 src/libnetdata/stacktrace/stacktrace-none.c
1277 src/libnetdata/stacktrace/stacktrace-log.c
1278 src/libnetdata/stacktrace/stacktrace-unittest.c
1279 )
1280
1281 list(APPEND LIBNETDATA_FILES ${LIBNETDATA_STACKTRACE_FILES})
1282 endif()
1283
1284 list(APPEND LIBNETDATA_FILES ${INICFG_FILES})
1285 list(APPEND LIBNETDATA_FILES ${CONFIG_FILES})
1286
1287 set(DAEMON_FILES
1288 src/daemon/buildinfo.c
1289 src/daemon/buildinfo.h
1290 src/daemon/common.c
1291 src/daemon/common.h
1292 src/daemon/daemon.c
1293 src/daemon/daemon.h
1294 src/daemon/libuv_workers.c
1295 src/daemon/libuv_workers.h
1296 src/daemon/pulse/pulse.c
1297 src/daemon/pulse/pulse.h
1298 src/daemon/analytics.c
1299 src/daemon/analytics.h
1300 src/daemon/main.c
1301 src/daemon/main.h
1302 src/daemon/environment.c
1303 src/daemon/win_system-info.c
1304 src/daemon/win_system-info.h
1305 src/daemon/signal-handler.c
1306 src/daemon/signal-handler.h
1307 src/daemon/service.c
1308 src/daemon/daemon-shutdown-watcher.c
1309 src/daemon/daemon-shutdown-watcher.h
1310 src/daemon/static_threads.c
1311 src/daemon/static_threads.h
1312 src/daemon/commands.c
1313 src/daemon/commands.h
1314 src/daemon/pipename.c
1315 src/daemon/pipename.h
1316 src/daemon/unit_test.c
1317 src/daemon/unit_test.h
1318 src/daemon/dyncfg/dyncfg.c
1319 src/daemon/dyncfg/dyncfg.h
1320 src/daemon/dyncfg/dyncfg-files.c
1321 src/daemon/dyncfg/dyncfg-unittest.c
1322 src/daemon/dyncfg/dyncfg-inline.c
1323 src/daemon/dyncfg/dyncfg-echo.c
1324 src/daemon/dyncfg/dyncfg-internals.h
1325 src/daemon/dyncfg/dyncfg-intercept.c
1326 src/daemon/dyncfg/dyncfg-tree.c
1327 src/daemon/pulse/pulse-http-api.c
1328 src/daemon/pulse/pulse-http-api.h
1329 src/daemon/pulse/pulse-queries.c
1330 src/daemon/pulse/pulse-queries.h
1331 src/daemon/pulse/pulse-ingestion.c
1332 src/daemon/pulse/pulse-ingestion.h
1333 src/daemon/pulse/pulse-ml.c
1334 src/daemon/pulse/pulse-ml.h
1335 src/daemon/pulse/pulse-gorilla.c
1336 src/daemon/pulse/pulse-gorilla.h
1337 src/daemon/pulse/pulse-daemon.c
1338 src/daemon/pulse/pulse-daemon.h
1339 src/daemon/pulse/pulse-daemon-memory.c
1340 src/daemon/pulse/pulse-daemon-memory.h
1341 src/daemon/pulse/pulse-sqlite3.c
1342 src/daemon/pulse/pulse-sqlite3.h
1343 src/daemon/pulse/pulse-db-dbengine.c
1344 src/daemon/pulse/pulse-db-dbengine.h
1345 src/daemon/pulse/pulse-string.c
1346 src/daemon/pulse/pulse-string.h
1347 src/daemon/pulse/pulse-heartbeat.c
1348 src/daemon/pulse/pulse-heartbeat.h
1349 src/daemon/pulse/pulse-dictionary.c
1350 src/daemon/pulse/pulse-dictionary.h
1351 src/daemon/pulse/pulse-workers.c
1352 src/daemon/pulse/pulse-workers.h
1353 src/daemon/pulse/pulse-trace-allocations.c
1354 src/daemon/pulse/pulse-trace-allocations.h
1355 src/daemon/pulse/pulse-aral.c
1356 src/daemon/pulse/pulse-aral.h
1357 src/daemon/config/netdata-conf-db.c
1358 src/daemon/config/netdata-conf-db.h
1359 src/daemon/config/netdata-conf.h
1360 src/daemon/config/netdata-conf-backwards-compatibility.c
1361 src/daemon/config/netdata-conf-backwards-compatibility.h
1362 src/daemon/config/netdata-conf-web.c
1363 src/daemon/config/netdata-conf-web.h
1364 src/daemon/config/netdata-conf-directories.c
1365 src/daemon/config/netdata-conf-directories.h
1366 src/daemon/config/netdata-conf-logs.c
1367 src/daemon/config/netdata-conf-logs.h
1368 src/daemon/config/netdata-conf-global.c
1369 src/daemon/config/netdata-conf-global.h
1370 src/daemon/config/netdata-conf.c
1371 src/daemon/daemon-shutdown.c
1372 src/daemon/daemon-shutdown.h
1373 src/daemon/daemon-service.c
1374 src/daemon/daemon-service.h
1375 src/daemon/pulse/pulse-db-rrd.c
1376 src/daemon/pulse/pulse-db-rrd.h
1377 src/daemon/config/netdata-conf-cloud.c
1378 src/daemon/config/netdata-conf-cloud.h
1379 src/daemon/config/netdata-conf-profile.c
1380 src/daemon/config/netdata-conf-profile.h
1381 src/daemon/pulse/pulse-daemon-memory-system.c
1382 src/daemon/pulse/pulse-network.c
1383 src/daemon/pulse/pulse-network.h
1384 src/daemon/pulse/pulse-db-dbengine-retention.c
1385 src/daemon/pulse/pulse-db-dbengine-retention.h
1386 src/daemon/pulse/pulse-parents.c
1387 src/daemon/pulse/pulse-parents.h
1388 src/daemon/status-file.c
1389 src/daemon/status-file.h
1390 src/daemon/config/netdata-conf-ssl.c
1391 src/daemon/config/netdata-conf-ssl.h
1392 src/daemon/machine-guid.c
1393 src/daemon/machine-guid.h
1394 src/daemon/status-file-dedup.c
1395 src/daemon/status-file-dedup.h
1396 src/daemon/status-file-io.c
1397 src/daemon/status-file-io.h
1398 src/daemon/status-file-dmi.c
1399 src/daemon/status-file-dmi.h
1400 src/daemon/status-file-product.c
1401 src/daemon/status-file-product.h
1402 src/daemon/protected-access.c
1403 src/daemon/protected-access.h
1404 )
1405
1406 set(DAEMON_SYSTEMD_WATCHER_FILES
1407 src/daemon/daemon-systemd-watcher.c
1408 src/daemon/daemon-systemd-watcher.h
1409 )
1410
1411 if(ENABLE_SYSTEMD_DBUS)
1412 list(APPEND DAEMON_FILES ${DAEMON_SYSTEMD_WATCHER_FILES})
1413 endif()
1414
1415 set(API_PLUGIN_FILES
1416 src/web/api/web_api.c
1417 src/web/api/web_api.h
1418 src/web/api/web_api_v1.c
1419 src/web/api/web_api_v1.h
1420 src/web/api/web_api_v2.c
1421 src/web/api/web_api_v2.h
1422 src/web/api/web_api_v3.c
1423 src/web/api/web_api_v3.h
1424 src/web/api/http_auth.c
1425 src/web/api/http_auth.h
1426 src/web/api/http_header.c
1427 src/web/api/http_header.h
1428 src/web/api/maps/rrdr_options.c
1429 src/web/api/maps/rrdr_options.h
1430 src/web/api/maps/contexts_options.c
1431 src/web/api/maps/contexts_options.h
1432 src/web/api/maps/datasource_formats.c
1433 src/web/api/maps/datasource_formats.h
1434 src/web/api/maps/maps.h
1435 src/web/api/maps/contexts_alert_statuses.c
1436 src/web/api/maps/contexts_alert_statuses.h
1437 src/web/api/v1/api_v1_allmetrics.c
1438 src/web/api/v1/api_v1_badge/web_buffer_svg.c
1439 src/web/api/v1/api_v1_function.c
1440 src/web/api/v1/api_v1_manage.c
1441 src/web/api/v1/api_v1_calls.h
1442 src/web/api/v1/api_v1_dbengine.c
1443 src/web/api/v1/api_v1_config.c
1444 src/web/api/v1/api_v1_functions.c
1445 src/web/api/v1/api_v1_weights.c
1446 src/web/api/v1/api_v1_info.c
1447 src/web/api/v1/api_v1_registry.c
1448 src/web/api/v1/api_v1_data.c
1449 src/web/api/v1/api_v1_contexts.c
1450 src/web/api/v1/api_v1_ml_info.c
1451 src/web/api/v1/api_v1_aclk.c
1452 src/web/api/v1/api_v1_context.c
1453 src/web/api/v1/api_v1_alarms.c
1454 src/web/api/v1/api_v1_charts.c
1455 src/web/api/v2/api_v2_info.c
1456 src/web/api/v2/api_v2_nodes.c
1457 src/web/api/v2/api_v2_node_instances.c
1458 src/web/api/v2/api_v2_q.c
1459 src/web/api/v2/api_v2_versions.c
1460 src/web/api/v2/api_v2_functions.c
1461 src/web/api/v2/api_v2_alerts.c
1462 src/web/api/v2/api_v2_alert_transitions.c
1463 src/web/api/v2/api_v2_bearer.c
1464 src/web/api/v2/api_v2_calls.h
1465 src/web/api/v2/api_v2_data.c
1466 src/web/api/v2/api_v2_progress.c
1467 src/web/api/v2/api_v2_weights.c
1468 src/web/api/v2/api_v2_alert_config.c
1469 src/web/api/v2/api_v2_contexts.c
1470 src/web/api/v2/api_v2_claim.c
1471 src/web/api/v2/api_v2_webrtc.c
1472 src/web/api/v3/api_v3_calls.h
1473 src/web/api/v3/api_v3_settings.c
1474 src/web/api/functions/functions.c
1475 src/web/api/functions/functions.h
1476 src/web/api/functions/function-progress.c
1477 src/web/api/functions/function-progress.h
1478 src/web/api/functions/function-netdata-streaming.c
1479 src/web/api/functions/function-netdata-streaming.h
1480 src/web/api/functions/function-topology-streaming.c
1481 src/web/api/functions/function-topology-streaming.h
1482 src/web/api/queries/rrdr.c
1483 src/web/api/queries/rrdr.h
1484 src/web/api/queries/query.c
1485 src/web/api/queries/query.h
1486 src/web/api/queries/query-execute.c
1487 src/web/api/queries/query-window.c
1488 src/web/api/queries/query-group-by.c
1489 src/web/api/queries/query-group-by-init.c
1490 src/web/api/queries/query-group-by-finalize.c
1491 src/web/api/queries/query-cardinality-limit.c
1492 src/web/api/queries/query-group-over-time.c
1493 src/web/api/queries/query-internal.h
1494 src/web/api/queries/query-plan.c
1495 src/web/api/queries/average/average.c
1496 src/web/api/queries/average/average.h
1497 src/web/api/queries/countif/countif.c
1498 src/web/api/queries/countif/countif.h
1499 src/web/api/queries/incremental_sum/incremental_sum.c
1500 src/web/api/queries/incremental_sum/incremental_sum.h
1501 src/web/api/queries/max/max.c
1502 src/web/api/queries/max/max.h
1503 src/web/api/queries/min/min.c
1504 src/web/api/queries/min/min.h
1505 src/web/api/queries/sum/sum.c
1506 src/web/api/queries/sum/sum.h
1507 src/web/api/queries/median/median.c
1508 src/web/api/queries/median/median.h
1509 src/web/api/queries/percentile/percentile.c
1510 src/web/api/queries/percentile/percentile.h
1511 src/web/api/queries/stddev/stddev.c
1512 src/web/api/queries/stddev/stddev.h
1513 src/web/api/queries/ses/ses.c
1514 src/web/api/queries/ses/ses.h
1515 src/web/api/queries/des/des.c
1516 src/web/api/queries/des/des.h
1517 src/web/api/queries/trimmed_mean/trimmed_mean.c
1518 src/web/api/queries/trimmed_mean/trimmed_mean.h
1519 src/web/api/queries/extremes/extremes.c
1520 src/web/api/queries/extremes/extremes.h
1521 src/web/api/queries/weights.c
1522 src/web/api/queries/weights.h
1523 src/web/api/formatters/rrd2json.c
1524 src/web/api/formatters/rrd2json.h
1525 src/web/api/formatters/csv/csv.c
1526 src/web/api/formatters/csv/csv.h
1527 src/web/api/formatters/json/json.c
1528 src/web/api/formatters/json/json.h
1529 src/web/api/formatters/ssv/ssv.c
1530 src/web/api/formatters/ssv/ssv.h
1531 src/web/api/formatters/value/value.c
1532 src/web/api/formatters/value/value.h
1533 src/web/api/formatters/jsonwrap.c
1534 src/web/api/formatters/jsonwrap.h
1535 src/web/api/formatters/jsonwrap-internal.h
1536 src/web/api/formatters/jsonwrap-objects-tree.c
1537 src/web/api/formatters/jsonwrap-query-plan.c
1538 src/web/api/formatters/jsonwrap-summary-alerts.c
1539 src/web/api/formatters/jsonwrap-summary-contexts.c
1540 src/web/api/formatters/jsonwrap-summary-dimensions.c
1541 src/web/api/formatters/jsonwrap-summary-instances.c
1542 src/web/api/formatters/jsonwrap-summary-labels.c
1543 src/web/api/formatters/jsonwrap-summary-nodes.c
1544 src/web/api/formatters/jsonwrap-v1.c
1545 src/web/api/formatters/jsonwrap-v2.c
1546 src/web/api/formatters/charts2json.c
1547 src/web/api/formatters/charts2json.h
1548 src/web/api/formatters/rrdset2json.c
1549 src/web/api/formatters/rrdset2json.h
1550 src/web/rtc/webrtc.c
1551 src/web/rtc/webrtc.h
1552 src/web/api/functions/function-bearer_get_token.c
1553 src/web/api/functions/function-bearer_get_token.h
1554 src/web/api/v3/api_v3_me.c
1555 )
1556
1557 set(EXPORTING_ENGINE_FILES
1558 src/exporting/exporting_engine.c
1559 src/exporting/exporting_engine.h
1560 src/exporting/graphite/graphite.c
1561 src/exporting/graphite/graphite.h
1562 src/exporting/json/json.c
1563 src/exporting/json/json.h
1564 src/exporting/opentsdb/opentsdb.c
1565 src/exporting/opentsdb/opentsdb.h
1566 src/exporting/prometheus/prometheus.c
1567 src/exporting/prometheus/prometheus.h
1568 src/exporting/read_config.c
1569 src/exporting/clean_connectors.c
1570 src/exporting/init_connectors.c
1571 src/exporting/process_data.c
1572 src/exporting/check_filters.c
1573 src/exporting/send_data.c
1574 src/exporting/send_internal_metrics.c
1575 )
1576
1577 set(HEALTH_PLUGIN_FILES
1578 src/health/health.c
1579 src/health/health.h
1580 src/health/health_config.c
1581 src/health/health-config-unittest.c
1582 src/health/health-config-unittest.h
1583 src/health/health_json.c
1584 src/health/health_log.c
1585 src/health/health_prototypes.c
1586 src/health/health_prototypes.h
1587 src/health/health_silencers.c
1588 src/health/health_silencers.h
1589 src/health/health_internals.h
1590 src/health/health_notifications.c
1591 src/health/health_event_loop.c
1592 src/health/health_dyncfg.c
1593 src/health/health_variable.c
1594 src/health/rrdcalc.c
1595 src/health/rrdcalc.h
1596 src/health/rrdvar.c
1597 src/health/rrdvar.h
1598 src/health/health-alert-entry.h
1599 src/health/health-alert-log.h
1600 )
1601
1602 set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c)
1603
1604 if(ENABLE_ML)
1605 set(ML_FILES
1606 src/ml/ad_charts.h
1607 src/ml/ad_charts.cc
1608 src/ml/ml.cc
1609 src/ml/ml_calculated_number.h
1610 src/ml/ml_host.h
1611 src/ml/ml_config.h
1612 src/ml/ml_config.cc
1613 src/ml/ml_dimension.h
1614 src/ml/ml_enums.h
1615 src/ml/ml_enums.cc
1616 src/ml/ml_features.h
1617 src/ml/ml_features.cc
1618 src/ml/ml_kmeans.h
1619 src/ml/ml_kmeans.cc
1620 src/ml/ml_queue.h
1621 src/ml/ml_worker.h
1622 src/ml/ml_string_wrapper.h
1623 src/ml/ml_queue.cc
1624 src/ml/ml_private.h
1625 src/ml/ml_public.h
1626 src/ml/ml_public.cc
1627 src/ml/ml-unittest.cc
1628 )
1629
1630 if(NOT ENABLE_MIMALLOC)
1631 list(APPEND ML_FILES src/ml/ml_memory.cc)
1632 endif()
1633 set_source_files_properties(${ML_FILES} PROPERTIES COMPILE_OPTIONS "-Wno-attributes")
1634 else()
1635 set(ML_FILES
1636 src/ml/ml_public.h
1637 src/ml/ml-dummy.c
1638 )
1639 endif()
1640
1641 set(INTERNAL_COLLECTORS_FILES
1642 src/collectors/common-contexts/common-contexts.h
1643 src/collectors/common-contexts/disk-await.h
1644 src/collectors/common-contexts/disk-avgsz.h
1645 src/collectors/common-contexts/disk-busy.h
1646 src/collectors/common-contexts/disk-io.h
1647 src/collectors/common-contexts/disk-iotime.h
1648 src/collectors/common-contexts/disk-ops.h
1649 src/collectors/common-contexts/disk-qops.h
1650 src/collectors/common-contexts/disk-svctm.h
1651 src/collectors/common-contexts/disk-util.h
1652 src/collectors/common-contexts/system-io.h
1653 src/collectors/common-contexts/system-interrupts.h
1654 src/collectors/common-contexts/system-processes.h
1655 src/collectors/common-contexts/system-ram.h
1656 src/collectors/common-contexts/mem-swap.h
1657 src/collectors/common-contexts/mem-pgfaults.h
1658 src/collectors/common-contexts/mem-available.h
1659 src/collectors/common-contexts/power-supply.h
1660 )
1661
1662 set(INTERCOMMUNICATION_COLLECTORS_FILES
1663 src/collectors/collectors-ipc/ebpf-ipc.c
1664 src/collectors/collectors-ipc/ebpf-ipc.h
1665 )
1666
1667 set(PLUGINSD_PLUGIN_FILES
1668 src/plugins.d/plugins_d.c
1669 src/plugins.d/plugins_d.h
1670 src/plugins.d/pluginsd_dyncfg.c
1671 src/plugins.d/pluginsd_dyncfg.h
1672 src/plugins.d/pluginsd_functions.c
1673 src/plugins.d/pluginsd_functions.h
1674 src/plugins.d/pluginsd_internals.c
1675 src/plugins.d/pluginsd_internals.h
1676 src/plugins.d/pluginsd_parser.c
1677 src/plugins.d/pluginsd_parser.h
1678 src/plugins.d/pluginsd_replication.c
1679 src/plugins.d/pluginsd_replication.h
1680 )
1681
1682 set(RRD_PLUGIN_FILES
1683 src/database/contexts/api_v1_contexts.c
1684 src/database/contexts/api_v2_contexts.c
1685 src/database/contexts/api_v2_contexts.h
1686 src/database/contexts/api_v2_contexts_agents.c
1687 src/database/contexts/api_v2_contexts_alerts.c
1688 src/database/contexts/api_v2_contexts_alerts.h
1689 src/database/contexts/api_v2_contexts_alert_transitions.c
1690 src/database/contexts/api_v2_contexts_alert_config.c
1691 src/database/contexts/rrdcontext-context.c
1692 src/database/contexts/rrdcontext-instance.c
1693 src/database/contexts/rrdcontext-internal.h
1694 src/database/contexts/rrdcontext-metric.c
1695 src/database/contexts/query_scope.c
1696 src/database/contexts/query_target.c
1697 src/database/contexts/rrdcontext.c
1698 src/database/contexts/rrdcontext.h
1699 src/database/contexts/rrdcontext-worker.c
1700 src/database/rrdcollector.c
1701 src/database/rrdcollector.h
1702 src/database/rrddim.c
1703 src/database/rrdfunctions.c
1704 src/database/rrdfunctions.h
1705 src/database/rrdfunctions-inline.c
1706 src/database/rrdfunctions-inline.h
1707 src/database/rrdhost.c
1708 src/database/rrdlabels.c
1709 src/database/rrdlabels-aggregated.c
1710 src/database/rrdlabels-aggregated.h
1711 src/database/rrd.c
1712 src/database/rrd.h
1713 src/database/rrd-metadata.c
1714 src/database/rrd-metadata.h
1715 src/database/rrd-retention.c
1716 src/database/rrd-retention.h
1717 src/database/rrdset.c
1718 src/database/storage-engine.c
1719 src/database/storage-engine.h
1720 src/database/ram/rrddim_mem.c
1721 src/database/ram/rrddim_mem.h
1722 src/database/sqlite/sqlite_metadata.c
1723 src/database/sqlite/sqlite_metadata.h
1724 src/database/sqlite/sqlite_functions.c
1725 src/database/sqlite/sqlite_functions.h
1726 src/database/sqlite/sqlite_context.c
1727 src/database/sqlite/sqlite_context.h
1728 src/database/sqlite/sqlite_db_migration.c
1729 src/database/sqlite/sqlite_db_migration.h
1730 src/database/sqlite/sqlite_aclk.c
1731 src/database/sqlite/sqlite_aclk.h
1732 src/database/sqlite/sqlite_health.c
1733 src/database/sqlite/sqlite_health.h
1734 src/database/sqlite/sqlite_aclk_node.c
1735 src/database/sqlite/sqlite_aclk_node.h
1736 src/database/sqlite/sqlite_aclk_alert.c
1737 src/database/sqlite/sqlite_aclk_alert.h
1738 src/database/sqlite/vendored/sqlite3.c
1739 src/database/sqlite/vendored/sqlite3.h
1740 src/database/sqlite/vendored/sqlite3recover.c
1741 src/database/sqlite/vendored/sqlite3recover.h
1742 src/database/sqlite/vendored/dbdata.c
1743 src/web/api/queries/KolmogorovSmirnovDist.c
1744 src/web/api/queries/KolmogorovSmirnovDist.h
1745 src/database/rrdfunctions-inflight.c
1746 src/database/rrdfunctions-inflight.h
1747 src/database/rrdfunctions-exporters.c
1748 src/database/rrdfunctions-exporters.h
1749 src/database/rrdfunctions-internals.h
1750 src/database/rrdcollector-internals.h
1751 src/database/rrd-database-mode.h
1752 src/database/rrd-database-mode.c
1753 src/database/rrdhost-system-info.c
1754 src/database/rrdhost-system-info.h
1755 src/database/contexts/rrdcontext-loading.c
1756 src/database/rrdset-index-id.c
1757 src/database/rrdset-index-id.h
1758 src/database/rrdset-index-name.c
1759 src/database/rrdset-index-name.h
1760 src/database/rrdset-slots.c
1761 src/database/rrdset-slots.h
1762 src/database/rrdset-collection.c
1763 src/database/rrdset-collection.h
1764 src/database/rrdset.h
1765 src/database/rrdhost.h
1766 src/database/rrdhost-status.c
1767 src/database/rrdhost-status.h
1768 src/database/rrddim.h
1769 src/database/rrddim-backfill.c
1770 src/database/rrddim-backfill.h
1771 src/database/rrddim-collection.c
1772 src/database/rrddim-collection.h
1773 src/database/rrdset-type.c
1774 src/database/rrdset-type.h
1775 src/database/rrdhost-slots.c
1776 src/database/rrdhost-slots.h
1777 src/database/rrd-algorithm.c
1778 src/database/rrd-algorithm.h
1779 src/database/rrdhost-labels.c
1780 src/database/rrdhost-labels.h
1781 src/database/rrdhost-collection.c
1782 src/database/rrdhost-collection.h
1783 src/database/pattern-array.c
1784 src/database/pattern-array.h
1785 src/database/contexts/rrdcontext-queues.c
1786 src/database/contexts/rrdcontext-context-registry.c
1787 src/database/contexts/rrdcontext-context-registry.h
1788 )
1789
1790 if(ENABLE_DBENGINE)
1791 list(APPEND RRD_PLUGIN_FILES
1792 src/database/engine/rrdengine.c
1793 src/database/engine/rrdengine.h
1794 src/database/engine/rrddiskprotocol.h
1795 src/database/engine/datafile.c
1796 src/database/engine/datafile.h
1797 src/database/engine/journalfile.c
1798 src/database/engine/journalfile.h
1799 src/database/engine/rrdenginelib.c
1800 src/database/engine/rrdenginelib.h
1801 src/database/engine/rrdengineapi.c
1802 src/database/engine/rrdengineapi.h
1803 src/database/engine/pagecache.c
1804 src/database/engine/pagecache.h
1805 src/database/engine/page_test.cc
1806 src/database/engine/page.c
1807 src/database/engine/page.h
1808 src/database/engine/cache.c
1809 src/database/engine/cache.h
1810 src/database/engine/mrg.c
1811 src/database/engine/mrg.h
1812 src/database/engine/mrg-internals.h
1813 src/database/engine/mrg-unittest.c
1814 src/database/engine/mrg-load.c
1815 src/database/engine/pdc.c
1816 src/database/engine/pdc.h
1817 src/database/engine/dbengine-unittest.c
1818 src/database/engine/dbengine-stresstest.c
1819 src/database/engine/dbengine-compression.c
1820 src/database/engine/dbengine-compression.h
1821 )
1822 endif()
1823
1824 set(REGISTRY_PLUGIN_FILES
1825 src/registry/registry.c
1826 src/registry/registry.h
1827 src/registry/registry_db.c
1828 src/registry/registry_init.c
1829 src/registry/registry_internals.c
1830 src/registry/registry_internals.h
1831 src/registry/registry_log.c
1832 src/registry/registry_machine.c
1833 src/registry/registry_machine.h
1834 src/registry/registry_person.c
1835 src/registry/registry_person.h
1836 )
1837
1838 set(STATSD_PLUGIN_FILES
1839 src/collectors/statsd.plugin/statsd.c
1840 )
1841
1842 set(SYSTEMD_JOURNAL_PLUGIN_FILES
1843 src/collectors/systemd-journal.plugin/systemd-journal-fstat.c
1844 src/collectors/systemd-journal.plugin/systemd-internals.h
1845 src/collectors/systemd-journal.plugin/systemd-main.c
1846 src/collectors/systemd-journal.plugin/systemd-journal.c
1847 src/collectors/systemd-journal.plugin/systemd-journal-function.h
1848 src/collectors/systemd-journal.plugin/systemd-journal-execute.h
1849 src/collectors/systemd-journal.plugin/systemd-journal-annotations.c
1850 src/collectors/systemd-journal.plugin/systemd-journal-files.c
1851 src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
1852 src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c
1853 src/collectors/systemd-journal.plugin/provider/netdata_provider.c
1854 src/collectors/systemd-journal.plugin/provider/netdata_provider.h
1855 src/collectors/systemd-journal.plugin/provider/rust_provider.h
1856 src/libnetdata/os/system-maps/system-services.h
1857 src/collectors/systemd-journal.plugin/systemd-journal-sampling.h
1858 )
1859
1860 set(SYSTEMD_UNITS_PLUGIN_FILES
1861 src/collectors/systemd-units.plugin/plugin_systemd_units.c
1862 )
1863
1864 set(STREAMING_PLUGIN_FILES
1865 src/streaming/stream.h
1866 src/streaming/stream-compression/compression.c
1867 src/streaming/stream-compression/compression.h
1868 src/streaming/stream-compression/brotli.c
1869 src/streaming/stream-compression/brotli.h
1870 src/streaming/stream-compression/gzip.c
1871 src/streaming/stream-compression/gzip.h
1872 src/streaming/stream-compression/lz4.c
1873 src/streaming/stream-compression/lz4.h
1874 src/streaming/stream-compression/zstd.c
1875 src/streaming/stream-compression/zstd.h
1876 src/streaming/stream-receiver.c
1877 src/streaming/stream-sender.c
1878 src/streaming/stream-replication-sender.c
1879 src/streaming/stream-replication-sender.h
1880 src/streaming/protocol/command-nodeid.c
1881 src/streaming/protocol/commands.c
1882 src/streaming/protocol/commands.h
1883 src/streaming/protocol/command-claimed_id.c
1884 src/streaming/stream-path.c
1885 src/streaming/stream-path.h
1886 src/streaming/stream-capabilities.c
1887 src/streaming/stream-capabilities.h
1888 src/streaming/stream-connector.c
1889 src/streaming/stream-sender-internals.h
1890 src/streaming/stream-sender-execute.c
1891 src/streaming/stream-sender-commit.c
1892 src/streaming/stream-parents.c
1893 src/streaming/stream-handshake.c
1894 src/streaming/protocol/command-function.c
1895 src/streaming/protocol/command-host-labels.c
1896 src/streaming/protocol/command-chart-definition.c
1897 src/streaming/protocol/command-begin-set-end-v2.c
1898 src/streaming/protocol/command-host-variables.c
1899 src/streaming/stream-conf.c
1900 src/streaming/stream-conf.h
1901 src/streaming/stream-handshake.h
1902 src/streaming/stream-parents.h
1903 src/streaming/stream-sender-api.c
1904 src/streaming/stream-receiver-internals.h
1905 src/streaming/stream-receiver-api.c
1906 src/streaming/stream-thread.c
1907 src/streaming/stream-thread.h
1908 src/streaming/stream-receiver-connection.c
1909 src/streaming/stream-sender-commit.h
1910 src/streaming/stream-traffic-types.h
1911 src/streaming/stream-circular-buffer.c
1912 src/streaming/stream-circular-buffer.h
1913 src/streaming/stream-control.c
1914 src/streaming/stream-control.h
1915 src/streaming/stream-waiting-list.c
1916 src/streaming/stream-waiting-list.h
1917 src/streaming/stream-replication-receiver.c
1918 src/streaming/stream-replication-receiver.h
1919 src/streaming/stream-replication-tracking.c
1920 src/streaming/stream-replication-tracking.h
1921 src/streaming/protocol/command-begin-set-end-v1.c
1922 src/streaming/protocol/command-begin-set-end-init.c
1923 )
1924
1925 set(WEB_PLUGIN_FILES
1926 src/web/api/functions/function-metrics-cardinality.c
1927 src/web/api/functions/function-metrics-cardinality.h
1928 src/web/api/queries/backfill.c
1929 src/web/api/queries/backfill.h
1930 src/web/api/v3/api_v3_stream_info.c
1931 src/web/api/v3/api_v3_stream_path.c
1932 src/web/mcp/adapters/mcp-websocket.c
1933 src/web/mcp/adapters/mcp-websocket.h
1934 src/web/mcp/adapters/mcp-http.c
1935 src/web/mcp/adapters/mcp-http.h
1936 src/web/mcp/adapters/mcp-http-common.h
1937 src/web/mcp/adapters/mcp-sse.c
1938 src/web/mcp/adapters/mcp-sse.h
1939 src/web/mcp/mcp-jsonrpc.c
1940 src/web/mcp/mcp-jsonrpc.h
1941 src/web/mcp/mcp-initialize.c
1942 src/web/mcp/mcp-initialize.h
1943 src/web/mcp/mcp-prompts.c
1944 src/web/mcp/mcp-prompts.h
1945 src/web/mcp/mcp-resources.c
1946 src/web/mcp/mcp-resources.h
1947 src/web/mcp/mcp-tools.c
1948 src/web/mcp/mcp-tools.h
1949 src/web/mcp/mcp-tools-list-metadata.c
1950 src/web/mcp/mcp-tools-list-metadata.h
1951 src/web/mcp/mcp-tools-execute-function.c
1952 src/web/mcp/mcp-tools-execute-function.h
1953 src/web/mcp/mcp-tools-execute-function-internal.h
1954 src/web/mcp/mcp-tools-execute-function-registry.c
1955 src/web/mcp/mcp-tools-execute-function-registry.h
1956 src/web/mcp/mcp-tools-query-metrics.c
1957 src/web/mcp/mcp-tools-query-metrics.h
1958 src/web/mcp/mcp-tools-weights.c
1959 src/web/mcp/mcp-tools-weights.h
1960 src/web/mcp/mcp-tools-alert-transitions.c
1961 src/web/mcp/mcp-tools-alert-transitions.h
1962 src/web/mcp/mcp-tools-configured-alerts.c
1963 src/web/mcp/mcp-tools-configured-alerts.h
1964 src/web/mcp/mcp-params.c
1965 src/web/mcp/mcp-params.h
1966 src/web/mcp/mcp-ping.c
1967 src/web/mcp/mcp-ping.h
1968 src/web/mcp/mcp-logging.c
1969 src/web/mcp/mcp-logging.h
1970 src/web/mcp/mcp-completion.c
1971 src/web/mcp/mcp-completion.h
1972 src/web/api/mcp_auth.c
1973 src/web/api/mcp_auth.h
1974 src/web/mcp/mcp.c
1975 src/web/mcp/mcp.h
1976 src/web/server/static/static-threaded.c
1977 src/web/server/static/static-threaded.h
1978 src/web/server/web_client.c
1979 src/web/server/web_client.h
1980 src/web/server/web_client_cache.c
1981 src/web/server/web_client_cache.h
1982 src/web/server/web_server.c
1983 src/web/server/web_server.h
1984 src/web/websocket/websocket-buffer.h
1985 src/web/websocket/websocket-compression.c
1986 src/web/websocket/websocket-compression.h
1987 src/web/websocket/websocket-echo.c
1988 src/web/websocket/websocket-echo.h
1989 src/web/websocket/websocket-handshake.c
1990 src/web/websocket/websocket-internal.h
1991 src/web/websocket/websocket-jsonrpc.c
1992 src/web/websocket/websocket-jsonrpc.h
1993 src/web/websocket/websocket-message.c
1994 src/web/websocket/websocket-receive.c
1995 src/web/websocket/websocket-send.c
1996 src/web/websocket/websocket-thread.c
1997 src/web/websocket/websocket-thread.h
1998 src/web/websocket/websocket-utils.c
1999 src/web/websocket/websocket.c
2000 src/web/websocket/websocket.h
2001 )
2002
2003 set(CLAIM_PLUGIN_FILES
2004 src/claim/claim.c
2005 src/claim/claim.h
2006 src/claim/claim_id.c
2007 src/claim/claim_id.h
2008 src/claim/cloud-conf.c
2009 src/claim/claim-with-api.c
2010 src/claim/cloud-status.c
2011 src/claim/cloud-status.h
2012 )
2013
2014 set(CLAIM_WINDOWS_FILES
2015 src/claim/main.c
2016 src/claim/main.h
2017 src/claim/ui.c
2018 src/claim/ui.h
2019 )
2020
2021 set(ACLK_ALWAYS_BUILD
2022 src/aclk/aclk_proxy.c
2023 src/aclk/aclk_proxy.h
2024 src/aclk/aclk.c
2025 src/aclk/aclk.h
2026 src/aclk/aclk_capas.c
2027 src/aclk/aclk_capas.h
2028 src/aclk/aclk_util.c
2029 src/aclk/aclk_util.h
2030 src/aclk/https_client.c
2031 src/aclk/https_client.h
2032 src/libnetdata/c_rhash/c_rhash.c
2033 src/libnetdata/c_rhash/c_rhash.h
2034 src/libnetdata/c_rhash/c_rhash_internal.h
2035 )
2036
2037 set(TIMEX_PLUGIN_FILES
2038 src/collectors/timex.plugin/plugin_timex.c
2039 )
2040
2041 set(PROFILE_PLUGIN_FILES
2042 src/collectors/profile.plugin/plugin_profile.cc
2043 )
2044
2045 set(CGROUPS_PLUGIN_FILES
2046 src/collectors/cgroups.plugin/sys_fs_cgroup.c
2047 src/collectors/cgroups.plugin/sys_fs_cgroup.h
2048 src/collectors/cgroups.plugin/cgroup-internals.h
2049 src/collectors/cgroups.plugin/cgroup-discovery.c
2050 src/collectors/cgroups.plugin/cgroup-charts.c
2051 src/collectors/cgroups.plugin/cgroup-top.c
2052 src/collectors/cgroups.plugin/cgroup-netipc.c
2053 src/collectors/cgroups.plugin/cgroup-netipc.h
2054 )
2055
2056 set(DISKSPACE_PLUGIN_FILES
2057 src/collectors/diskspace.plugin/plugin_diskspace.c
2058 )
2059
2060 set(MACOS_PLUGIN_FILES
2061 src/collectors/macos.plugin/plugin_macos.c
2062 src/collectors/macos.plugin/plugin_macos.h
2063 src/collectors/macos.plugin/macos_sysctl.c
2064 src/collectors/macos.plugin/macos_mach_smi.c
2065 src/collectors/macos.plugin/macos_fw.c
2066 )
2067
2068 set(FREEBSD_PLUGIN_FILES
2069 src/collectors/freebsd.plugin/plugin_freebsd.c
2070 src/collectors/freebsd.plugin/plugin_freebsd.h
2071 src/collectors/freebsd.plugin/freebsd_sysctl.c
2072 src/collectors/freebsd.plugin/freebsd_getmntinfo.c
2073 src/collectors/freebsd.plugin/freebsd_getifaddrs.c
2074 src/collectors/freebsd.plugin/freebsd_devstat.c
2075 src/collectors/freebsd.plugin/freebsd_kstat_zfs.c
2076 src/collectors/freebsd.plugin/freebsd_ipfw.c
2077 src/collectors/proc.plugin/zfs_common.c
2078 src/collectors/proc.plugin/zfs_common.h
2079 )
2080
2081 set(WINDOWS_EVENTS_PLUGIN_FILES
2082 src/collectors/windows-events.plugin/windows-events.c
2083 src/collectors/windows-events.plugin/windows-events.h
2084 src/collectors/windows-events.plugin/windows-events-query.h
2085 src/collectors/windows-events.plugin/windows-events-query.c
2086 src/collectors/windows-events.plugin/windows-events-sources.c
2087 src/collectors/windows-events.plugin/windows-events-sources.h
2088 src/collectors/windows-events.plugin/windows-events-unicode.c
2089 src/collectors/windows-events.plugin/windows-events-unicode.h
2090 src/collectors/windows-events.plugin/windows-events-xml.c
2091 src/collectors/windows-events.plugin/windows-events-xml.h
2092 src/collectors/windows-events.plugin/windows-events-providers.c
2093 src/collectors/windows-events.plugin/windows-events-providers.h
2094 src/collectors/windows-events.plugin/windows-events-fields-cache.c
2095 src/collectors/windows-events.plugin/windows-events-fields-cache.h
2096 src/collectors/windows-events.plugin/windows-events-query-builder.c
2097 src/collectors/windows-events.plugin/windows-events-query-builder.h
2098 src/collectors/windows-events.plugin/windows-events-query-evt-variant.c
2099 )
2100
2101 set(WINDOWS_PLUGIN_FILES
2102 src/collectors/windows.plugin/windows_plugin.c
2103 src/collectors/windows.plugin/windows_plugin.h
2104 src/collectors/windows.plugin/GetSystemUptime.c
2105 src/collectors/windows.plugin/GetSystemRAM.c
2106 src/collectors/windows.plugin/GetSystemCPU.c
2107 src/collectors/windows.plugin/GetPowerSupply.c
2108 src/collectors/windows.plugin/GetServicesStatus.c
2109 src/collectors/windows.plugin/GetSensors.c
2110 src/collectors/windows.plugin/GetHardwareInfo.c
2111 src/collectors/windows.plugin/perflib-adcs.c
2112 src/collectors/windows.plugin/perflib-adfs.c
2113 src/collectors/windows.plugin/perflib-rrd.c
2114 src/collectors/windows.plugin/perflib-rrd.h
2115 src/collectors/windows.plugin/perflib-ad.c
2116 src/collectors/windows.plugin/perflib-storage.c
2117 src/collectors/windows.plugin/perflib-processor.c
2118 src/collectors/windows.plugin/perflib-thermalzone.c
2119 src/collectors/windows.plugin/perflib-objects.c
2120 src/collectors/windows.plugin/perflib-network.c
2121 src/collectors/windows.plugin/perflib-smb.c
2122 src/collectors/windows.plugin/perflib-netframework.c
2123 src/collectors/windows.plugin/perflib-memory.c
2124 src/collectors/windows.plugin/perflib-processes.c
2125 src/collectors/windows.plugin/perflib-web-service.c
2126 src/collectors/windows.plugin/perflib-hyperv.c
2127 src/collectors/windows.plugin/perflib-exchange.c
2128 src/collectors/windows.plugin/perflib-numa.c
2129 src/collectors/windows.plugin/perflib-asp.c
2130 )
2131
2132 set(WINDOWS_PLUGIN_DRIVER
2133 src/collectors/windows.plugin/driver/netdata_driver.c
2134 src/collectors/windows.plugin/driver/netdata_driver.h
2135 )
2136
2137 set(PROC_PLUGIN_FILES
2138 src/collectors/proc.plugin/ipc.c
2139 src/collectors/proc.plugin/plugin_proc.c
2140 src/collectors/proc.plugin/plugin_proc.h
2141 src/collectors/proc.plugin/proc_sys_fs_file_nr.c
2142 src/collectors/proc.plugin/proc_diskstats.c
2143 src/collectors/proc.plugin/proc_mdstat.c
2144 src/collectors/proc.plugin/proc_interrupts.c
2145 src/collectors/proc.plugin/proc_softirqs.c
2146 src/collectors/proc.plugin/proc_loadavg.c
2147 src/collectors/proc.plugin/proc_meminfo.c
2148 src/collectors/proc.plugin/proc_pagetypeinfo.c
2149 src/collectors/proc.plugin/proc_net_dev.c
2150 src/collectors/proc.plugin/proc_net_dev_renames.c
2151 src/collectors/proc.plugin/proc_net_dev_renames.h
2152 src/collectors/proc.plugin/proc_net_wireless.c
2153 src/collectors/proc.plugin/proc_net_ip_vs_stats.c
2154 src/collectors/proc.plugin/proc_net_netstat.c
2155 src/collectors/proc.plugin/proc_net_rpc_nfs.c
2156 src/collectors/proc.plugin/proc_net_rpc_nfsd.c
2157 src/collectors/proc.plugin/proc_net_sctp_snmp.c
2158 src/collectors/proc.plugin/proc_net_sockstat.c
2159 src/collectors/proc.plugin/proc_net_sockstat6.c
2160 src/collectors/proc.plugin/proc_net_softnet_stat.c
2161 src/collectors/proc.plugin/proc_net_stat_conntrack.c
2162 src/collectors/proc.plugin/proc_net_stat_synproxy.c
2163 src/collectors/proc.plugin/proc_self_mountinfo.c
2164 src/collectors/proc.plugin/proc_self_mountinfo.h
2165 src/collectors/proc.plugin/zfs_common.c
2166 src/collectors/proc.plugin/zfs_common.h
2167 src/collectors/proc.plugin/proc_spl_kstat_zfs.c
2168 src/collectors/proc.plugin/proc_stat.c
2169 src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
2170 src/collectors/proc.plugin/proc_vmstat.c
2171 src/collectors/proc.plugin/proc_uptime.c
2172 src/collectors/proc.plugin/run_reboot_required.c
2173 src/collectors/proc.plugin/proc_pressure.c
2174 src/collectors/proc.plugin/proc_pressure.h
2175 src/collectors/proc.plugin/sys_kernel_mm_ksm.c
2176 src/collectors/proc.plugin/sys_block_zram.c
2177 src/collectors/proc.plugin/sys_devices_system_edac_mc.c
2178 src/collectors/proc.plugin/sys_devices_system_node.c
2179 src/collectors/proc.plugin/sys_class_infiniband.c
2180 src/collectors/proc.plugin/sys_fs_btrfs.c
2181 src/collectors/proc.plugin/sys_class_power_supply.c
2182 src/collectors/proc.plugin/sys_devices_pci_aer.c
2183 src/collectors/proc.plugin/sys_class_drm.c
2184 )
2185
2186 set(TC_PLUGIN_FILES
2187 src/collectors/tc.plugin/plugin_tc.c
2188 )
2189
2190 set(NETDATA_FILES
2191 src/collectors/all.h
2192 ${DAEMON_FILES}
2193 ${API_PLUGIN_FILES}
2194 ${EXPORTING_ENGINE_FILES}
2195 ${HEALTH_PLUGIN_FILES}
2196 ${IDLEJITTER_PLUGIN_FILES}
2197 ${ML_FILES}
2198 ${PLUGINSD_PLUGIN_FILES}
2199 ${RRD_PLUGIN_FILES}
2200 ${REGISTRY_PLUGIN_FILES}
2201 ${STATSD_PLUGIN_FILES}
2202 ${STREAMING_PLUGIN_FILES}
2203 ${WEB_PLUGIN_FILES}
2204 ${CLAIM_PLUGIN_FILES}
2205 ${ACLK_ALWAYS_BUILD}
2206 ${PROFILE_PLUGIN_FILES}
2207 )
2208
2209 if(OS_LINUX)
2210 list(APPEND NETDATA_FILES
2211 src/daemon/static_threads_linux.c
2212 ${CGROUPS_PLUGIN_FILES}
2213 ${DISKSPACE_PLUGIN_FILES}
2214 ${PROC_PLUGIN_FILES}
2215 ${TC_PLUGIN_FILES}
2216 ${TIMEX_PLUGIN_FILES}
2217 ${INTERNAL_COLLECTORS_FILES}
2218 )
2219
2220 if(ENABLE_SENTRY)
2221 list(APPEND NETDATA_FILES
2222 src/daemon/sentry-native/sentry-native.c
2223 src/daemon/sentry-native/sentry-native.h)
2224 endif()
2225 elseif(OS_MACOS)
2226 list(APPEND NETDATA_FILES
2227 src/daemon/static_threads_macos.c
2228 ${MACOS_PLUGIN_FILES}
2229 ${TIMEX_PLUGIN_FILES}
2230 ${INTERNAL_COLLECTORS_FILES}
2231 )
2232 elseif(OS_FREEBSD)
2233 list(APPEND NETDATA_FILES
2234 src/daemon/static_threads_freebsd.c
2235 ${FREEBSD_PLUGIN_FILES}
2236 ${TIMEX_PLUGIN_FILES}
2237 ${INTERNAL_COLLECTORS_FILES}
2238 )
2239 elseif(OS_WINDOWS)
2240 list(APPEND NETDATA_FILES
2241 src/daemon/static_threads_windows.c
2242 src/daemon/winsvc.cc
2243 ${WINDOWS_PLUGIN_FILES}
2244 ${INTERNAL_COLLECTORS_FILES}
2245 )
2246 endif()
2247
2248 set(MQTT_WEBSOCKETS_FILES
2249 src/aclk/mqtt_websockets/mqtt_wss_client.c
2250 src/aclk/mqtt_websockets/mqtt_wss_client.h
2251 src/aclk/mqtt_websockets/ws_client.c
2252 src/aclk/mqtt_websockets/ws_client.h
2253 src/aclk/mqtt_websockets/mqtt_ng.c
2254 src/aclk/mqtt_websockets/mqtt_ng.h
2255 src/aclk/mqtt_websockets/common_public.c
2256 src/aclk/mqtt_websockets/common_public.h
2257 src/aclk/mqtt_websockets/common_internal.h
2258 src/aclk/mqtt_websockets/aclk_mqtt_workers.h
2259 )
2260
2261 set(ACLK_PROTO_DEFS
2262 src/aclk/aclk-schemas/proto/aclk/v1/lib.proto
2263 src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto
2264 src/aclk/aclk-schemas/proto/agent/v1/connection.proto
2265 src/aclk/aclk-schemas/proto/alarm/v1/config.proto
2266 src/aclk/aclk-schemas/proto/alarm/v1/stream.proto
2267 src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto
2268 src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto
2269 src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
2270 src/aclk/aclk-schemas/proto/context/v1/context.proto
2271 src/aclk/aclk-schemas/proto/context/v1/stream.proto
2272 src/aclk/aclk-schemas/proto/agent/v1/cmds.proto
2273 )
2274
2275 set(ACLK_FILES
2276 src/aclk/aclk_query.c
2277 src/aclk/aclk_query.h
2278 src/aclk/aclk_query_queue.c
2279 src/aclk/aclk_query_queue.h
2280 src/aclk/aclk_otp.c
2281 src/aclk/aclk_otp.h
2282 src/aclk/aclk_tx_msgs.c
2283 src/aclk/aclk_tx_msgs.h
2284 src/aclk/aclk_rx_msgs.c
2285 src/aclk/aclk_rx_msgs.h
2286 src/aclk/aclk_alarm_api.c
2287 src/aclk/aclk_alarm_api.h
2288 src/aclk/aclk_contexts_api.c
2289 src/aclk/aclk_contexts_api.h
2290 src/aclk/schema-wrappers/connection.cc
2291 src/aclk/schema-wrappers/connection.h
2292 src/aclk/schema-wrappers/node_connection.cc
2293 src/aclk/schema-wrappers/node_connection.h
2294 src/aclk/schema-wrappers/node_creation.cc
2295 src/aclk/schema-wrappers/node_creation.h
2296 src/aclk/schema-wrappers/alarm_stream.cc
2297 src/aclk/schema-wrappers/alarm_stream.h
2298 src/aclk/schema-wrappers/alarm_config.cc
2299 src/aclk/schema-wrappers/alarm_config.h
2300 src/aclk/schema-wrappers/node_info.cc
2301 src/aclk/schema-wrappers/node_info.h
2302 src/aclk/schema-wrappers/capability.cc
2303 src/aclk/schema-wrappers/capability.h
2304 src/aclk/schema-wrappers/proto_2_json.cc
2305 src/aclk/schema-wrappers/proto_2_json.h
2306 src/aclk/schema-wrappers/context_stream.cc
2307 src/aclk/schema-wrappers/context_stream.h
2308 src/aclk/schema-wrappers/context.cc
2309 src/aclk/schema-wrappers/rrdcontext-context.h
2310 src/aclk/schema-wrappers/schema_wrappers.h
2311 src/aclk/schema-wrappers/schema_wrapper_utils.cc
2312 src/aclk/schema-wrappers/schema_wrapper_utils.h
2313 src/aclk/schema-wrappers/agent_cmds.cc
2314 src/aclk/schema-wrappers/agent_cmds.h
2315 )
2316 set_source_files_properties(src/aclk/schema-wrappers/proto_2_json.cc PROPERTIES COMPILE_OPTIONS "-Wno-unused-result")
2317
2318 set(MONGODB_EXPORTING_FILES
2319 src/exporting/mongodb/mongodb.c
2320 src/exporting/mongodb/mongodb.h
2321 )
2322
2323 set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
2324 src/exporting/prometheus/remote_write/remote_write.c
2325 src/exporting/prometheus/remote_write/remote_write.h
2326 src/exporting/prometheus/remote_write/remote_write_request.cc
2327 src/exporting/prometheus/remote_write/remote_write_request.h
2328 )
2329
2330 #
2331 # build libjudy
2332 #
2333
2334 add_library(judy STATIC ${LIBJUDY_SOURCES})
2335
2336 target_compile_options(judy PRIVATE
2337 -Wno-all -Wno-extra
2338 -Wno-shadow
2339 -Wformat
2340 )
2341
2342 target_compile_definitions(judy PRIVATE
2343 JUDYL
2344 $<$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>:JU_64BIT>
2345 )
2346
2347 target_include_directories(judy PUBLIC
2348 src/libnetdata/libjudy/vendored
2349 src/libnetdata/libjudy/vendored/JudyCommon
2350 )
2351
2352 set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV")
2353 set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT")
2354 set_source_files_properties(src/libnetdata/libjudy/vendored/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE")
2355 set_source_files_properties(src/libnetdata/libjudy/vendored/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB")
2356 set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL")
2357
2358 #
2359 # build netipc (standalone IPC library, no Netdata deps)
2360 #
2361
2362 set(NETIPC_PROTOCOL_FILES
2363 src/libnetdata/netipc/src/protocol/netipc_protocol.c
2364 src/libnetdata/netipc/src/protocol/netipc_protocol_increment.c
2365 src/libnetdata/netipc/src/protocol/netipc_protocol_string_reverse.c
2366 src/libnetdata/netipc/src/protocol/netipc_protocol_cgroups_snapshot.c
2367 src/libnetdata/netipc/src/protocol/netipc_protocol_lookup_common.c
2368 src/libnetdata/netipc/src/protocol/netipc_protocol_cgroups_lookup.c
2369 src/libnetdata/netipc/src/protocol/netipc_protocol_apps_lookup.c
2370 )
2371
2372 set(NETIPC_SERVICE_COMMON_FILES
2373 src/libnetdata/netipc/src/service/netipc_service_common.c
2374 src/libnetdata/netipc/src/service/netipc_service_cgroups_cache_common.c
2375 src/libnetdata/netipc/src/service/netipc_service_cgroups_cache.c
2376 src/libnetdata/netipc/src/service/netipc_service_cgroups_snapshot.c
2377 src/libnetdata/netipc/src/service/netipc_service_cgroups_lookup.c
2378 src/libnetdata/netipc/src/service/netipc_service_apps_lookup.c
2379 )
2380
2381 if(OS_LINUX)
2382 set(NETIPC_FILES
2383 ${NETIPC_PROTOCOL_FILES}
2384 src/libnetdata/netipc/src/transport/posix/netipc_uds.c
2385 src/libnetdata/netipc/src/transport/posix/netipc_uds_handshake.c
2386 src/libnetdata/netipc/src/transport/posix/netipc_uds_inflight.c
2387 src/libnetdata/netipc/src/transport/posix/netipc_uds_lifecycle.c
2388 src/libnetdata/netipc/src/transport/posix/netipc_uds_receive.c
2389 src/libnetdata/netipc/src/transport/posix/netipc_uds_send.c
2390 src/libnetdata/netipc/src/transport/posix/netipc_shm.c
2391 ${NETIPC_SERVICE_COMMON_FILES}
2392 src/libnetdata/netipc/src/service/netipc_service.c
2393 src/libnetdata/netipc/src/service/netipc_service_posix_client.c
2394 src/libnetdata/netipc/src/service/netipc_service_posix_client_connect.c
2395 src/libnetdata/netipc/src/service/netipc_service_posix_client_call.c
2396 src/libnetdata/netipc/src/service/netipc_service_posix_server.c
2397 src/libnetdata/netipc/src/service/netipc_service_posix_server_session.c
2398 )
2399
2400 add_library(netipc STATIC ${NETIPC_FILES})
2401 target_include_directories(netipc PUBLIC ${CMAKE_SOURCE_DIR}/src/libnetdata/netipc/include)
2402 target_link_libraries(netipc PUBLIC pthread rt)
2403 set_target_properties(netipc PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON)
2404 elseif(OS_WINDOWS)
2405 set(NETIPC_FILES
2406 ${NETIPC_PROTOCOL_FILES}
2407 src/libnetdata/netipc/src/transport/windows/netipc_named_pipe.c
2408 src/libnetdata/netipc/src/transport/windows/netipc_win_shm.c
2409 ${NETIPC_SERVICE_COMMON_FILES}
2410 src/libnetdata/netipc/src/service/netipc_service_win.c
2411 src/libnetdata/netipc/src/service/netipc_service_win_client.c
2412 src/libnetdata/netipc/src/service/netipc_service_win_client_connect.c
2413 src/libnetdata/netipc/src/service/netipc_service_win_client_call.c
2414 src/libnetdata/netipc/src/service/netipc_service_win_server.c
2415 src/libnetdata/netipc/src/service/netipc_service_win_server_session.c
2416 )
2417
2418 add_library(netipc STATIC ${NETIPC_FILES})
2419 target_include_directories(netipc PUBLIC ${CMAKE_SOURCE_DIR}/src/libnetdata/netipc/include)
2420 set_target_properties(netipc PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON)
2421 endif()
2422
2423 #
2424 # build libnetdata
2425 #
2426
2427 add_library(libnetdata STATIC ${LIBNETDATA_FILES})
2428 set_source_files_properties(src/libnetdata/gorilla/gorilla.cc PROPERTIES COMPILE_OPTIONS "-Wno-attributes")
2429
2430 target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)
2431
2432 # pthread (FIXME: use find_package for this)
2433
2434 # set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
2435 # set(THREADS_PREFER_PTHREAD_FLAG TRUE)
2436 # find_package(Threads REQUIRED)
2437
2438 # add_executable(test test.cpp)
2439 # target_link_libraries(test Threads::Threads)
2440
2441 target_link_libraries(libnetdata PUBLIC
2442 "$<$<BOOL:${ENABLE_MIMALLOC}>:mimalloc-static>"
2443 "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>"
2444 "$<$<OR:$<BOOL:${OS_LINUX}>,$<BOOL:${OS_FREEBSD}>>:pthread;rt>"
2445 "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4;wevtapi;ole32;oleaut32;wbemuuid;sensorsapi;iphlpapi>"
2446 "$<$<BOOL:${LINK_LIBM}>:m>"
2447 "${SYSTEMD_LDFLAGS}")
2448
2449 if(OS_LINUX OR OS_WINDOWS)
2450 target_link_libraries(libnetdata PUBLIC netipc)
2451 endif()
2452
2453 if(HAVE_LIBBACKTRACE)
2454 netdata_add_libbacktrace_to_target(libnetdata)
2455 endif()
2456
2457 if(OS_WINDOWS)
2458 set(HAVE_ETW True)
2459 set(HAVE_WEL True)
2460
2461 # Output the results for debugging purposes
2462 message(STATUS "Have Event Tracing for Windows (ETW): ${HAVE_ETW}")
2463 message(STATUS "Have Windows Event Log (WEL): ${HAVE_WEL}")
2464
2465 if(HAVE_WEL OR HAVE_ETW)
2466 # Define the source and generated file paths
2467 set(WEVT_GEN_SRC_H_FILE "${CMAKE_SOURCE_DIR}/src/libnetdata/log/nd_log-to-windows-common.h")
2468 set(WEVT_GEN_SRC_C_FILE "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_mc_generate.c")
2469 set(WEVT_GEN_BIN_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_mc_generate")
2470
2471 set(WEVT_BUILD_SCRIPT "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_compile.sh")
2472
2473 set(WEVT_MC_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.mc")
2474 set(WEVT_MAN_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_manifest.xml")
2475 set(WEVT_RC_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.rc")
2476 set(WEVT_MC_H_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.h")
2477 set(WEVT_MAN_H_FILE "${CMAKE_BINARY_DIR}/wevt_netdata_manifest.h")
2478 set(WEVT_RES_OBJECT "${CMAKE_BINARY_DIR}/wevt_netdata_res.o")
2479
2480 set(WEVT_DLL_FILE "${CMAKE_BINARY_DIR}/wevt_netdata.dll")
2481 set(WEVT_ETW_INSTALL_SCRIPT "${CMAKE_SOURCE_DIR}/src/libnetdata/log/wevt_netdata_install.bat")
2482
2483 # we compile ${WEVT_GEN_BIN_FILE}, which generates the manifest, the .mc,
2484 # and the headers required for compiling libnetdata/logs
2485
2486 if(HAVE_ETW)
2487 # ETW method also supports WEL
2488 # but it requires Microsoft tools mc, rc, and link
2489 add_custom_command(
2490 OUTPUT "${WEVT_MC_H_FILE}" "${WEVT_MAN_H_FILE}" "${WEVT_DLL_FILE}"
2491 COMMAND "${CMAKE_C_COMPILER}" -o "${WEVT_GEN_BIN_FILE}" "${WEVT_GEN_SRC_C_FILE}"
2492 COMMAND "${WEVT_GEN_BIN_FILE}" >"${WEVT_MC_FILE}"
2493 COMMAND "${WEVT_GEN_BIN_FILE}" --manifest >"${WEVT_MAN_FILE}"
2494 COMMAND "${WEVT_BUILD_SCRIPT}" "${CMAKE_SOURCE_DIR}/src/libnetdata/log" "${CMAKE_BINARY_DIR}"
2495 DEPENDS "${WEVT_GEN_SRC_C_FILE}" "${WEVT_GEN_SRC_H_FILE}"
2496 COMMENT "Compiling ${WEVT_MC_FILE} to generate ${WEVT_MC_H_FILE} and ${WEVT_DLL_FILE}"
2497 )
2498 else()
2499 # WEL method can be built with windmc, windres and the normal linker
2500 add_custom_command(
2501 OUTPUT "${WEVT_MC_H_FILE}" "${WEVT_DLL_FILE}"
2502 COMMAND "${CMAKE_C_COMPILER}" -o "${WEVT_GEN_BIN_FILE}" "${WEVT_GEN_SRC_C_FILE}"
2503 COMMAND "${WEVT_GEN_BIN_FILE}" >"${WEVT_MC_FILE}"
2504 COMMAND "${WEVT_GEN_BIN_FILE}" --manifest >"${WEVT_MAN_FILE}"
2505 COMMAND windmc -r "${CMAKE_BINARY_DIR}" -h "${CMAKE_BINARY_DIR}" ${WEVT_MC_FILE}
2506 COMMAND echo "1 2004" "wevt_netdata_manifest.xml" >> "${WEVT_RC_FILE}"
2507 COMMAND windres ${WEVT_RC_FILE} -o ${WEVT_RES_OBJECT}
2508 COMMAND ${CMAKE_LINKER} -dll --entry 0 -nostdlib -o ${WEVT_DLL_FILE} ${WEVT_RES_OBJECT}
2509 DEPENDS "${WEVT_GEN_SRC_C_FILE}" "${WEVT_GEN_SRC_H_FILE}"
2510 COMMENT "Compiling ${WEVT_MC_FILE} to generate ${WEVT_MC_H_FILE} and ${WEVT_DLL_FILE}"
2511 )
2512 endif()
2513
2514 # Create a custom target for the DLL
2515 add_custom_target(wevt_netdata ALL DEPENDS ${WEVT_DLL_FILE})
2516
2517 set_source_files_properties(src/libnetdata/log/nd_log-to-windows-events.c PROPERTIES
2518 OBJECT_DEPENDS "${WEVT_MC_H_FILE}")
2519
2520 if(HAVE_ETW)
2521 set_source_files_properties(src/libnetdata/log/nd_log-to-windows-events.c PROPERTIES
2522 OBJECT_DEPENDS "${WEVT_MAN_H_FILE}")
2523
2524 install(FILES "${WEVT_DLL_FILE}" "${WEVT_MAN_FILE}" "${WEVT_ETW_INSTALL_SCRIPT}"
2525 COMPONENT wevt_netdata_dll
2526 DESTINATION "${BINDIR}")
2527 else()
2528 # do not install the manifest in this case
2529 # the nsi installer will skip registering the ETW publisher
2530 install(FILES "${WEVT_DLL_FILE}"
2531 COMPONENT wevt_netdata_dll
2532 DESTINATION "${BINDIR}")
2533 endif()
2534 endif()
2535 endif()
2536
2537 # judy
2538 target_link_libraries(libnetdata PUBLIC judy)
2539
2540 netdata_add_jsonc_to_target(libnetdata)
2541
2542 netdata_add_libyaml_to_target(libnetdata)
2543
2544 # jemalloc
2545 if(ENABLE_JEMALLOC)
2546 target_link_libraries(libnetdata PUBLIC ${JEMALLOC_LIBRARIES})
2547 target_include_directories(libnetdata PUBLIC ${JEMALLOC_INCLUDE_DIRS})
2548 target_compile_options(libnetdata PUBLIC ${JEMALLOC_CFLAGS_OTHER})
2549 endif()
2550
2551 # libunwind
2552 if(ENABLE_LIBUNWIND)
2553 pkg_check_modules(LIBUNWIND libunwind IMPORTED_TARGET)
2554 if(TARGET PkgConfig::LIBUNWIND)
2555 set(HAVE_LIBUNWIND On)
2556
2557 if(STATIC_BUILD)
2558 set(unwind_prefix /libunwind-static/lib/libunwind-)
2559 set(suffix ${CMAKE_STATIC_LIBRARY_SUFFIX})
2560 else()
2561 set(unwind_prefix -lunwind-)
2562 set(suffix "")
2563 endif()
2564
2565 if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(amd64)")
2566 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND ${unwind_prefix}x86_64${suffix})
2567 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?.86")
2568 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND ${unwind_prefix}x86${suffix})
2569 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(aarch64)")
2570 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND ${unwind_prefix}aarch64${suffix})
2571 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
2572 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND ${unwind_prefix}arm${suffix})
2573 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "p(ower)?pc64")
2574 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND ${unwind_prefix}ppc64${suffix})
2575 else()
2576 message(WARNING "Unknown architecture ${CMAKE_SYSTEM_PROCESSOR} for libunwind. Stack traces may not work.")
2577 target_link_libraries(libnetdata PUBLIC PkgConfig::LIBUNWIND)
2578 endif()
2579 else()
2580 message(FATAL "Could not find libunwind for logging of stack traces")
2581 endif()
2582 endif()
2583
2584 # zlib
2585 if(OS_MACOS)
2586 find_package(ZLIB REQUIRED)
2587 target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
2588 target_link_libraries(libnetdata PUBLIC ZLIB::ZLIB)
2589 else()
2590 pkg_check_modules(ZLIB REQUIRED zlib)
2591 target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
2592 target_compile_options(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER})
2593 target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS})
2594 endif()
2595
2596 # lz4
2597 pkg_check_modules(LIBLZ4 REQUIRED liblz4>=1.7.1)
2598 if(LIBLZ4_FOUND)
2599 set(ENABLE_LZ4 On)
2600
2601 target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS})
2602 target_compile_options(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER})
2603 target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS})
2604 endif()
2605
2606 # zstd
2607 pkg_check_modules(LIBZSTD libzstd)
2608 if(LIBZSTD_FOUND)
2609 set(ENABLE_ZSTD On)
2610 target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS})
2611 target_compile_options(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER})
2612 target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS})
2613 endif()
2614
2615 # brotli
2616 pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon)
2617 if(LIBBROTLI_FOUND)
2618 set(ENABLE_BROTLI On)
2619 target_include_directories(libnetdata PUBLIC ${LIBBROTLI_INCLUDE_DIRS})
2620 target_compile_options(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER})
2621 target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS})
2622 endif()
2623
2624 # uuid
2625 if(OS_MACOS OR OS_WINDOWS)
2626 # UUID functionality is part of the system libraries here, so no extra
2627 # stuff needed.
2628 else()
2629 pkg_check_modules(UUID REQUIRED uuid)
2630 target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS})
2631 target_compile_options(libnetdata PUBLIC ${UUID_CFLAGS_OTHER})
2632 target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS})
2633 endif()
2634
2635 # uv
2636 pkg_check_modules(LIBUV REQUIRED libuv)
2637 target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS})
2638 target_compile_options(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER})
2639 target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS})
2640
2641 # crypto
2642 target_link_libraries(libnetdata PUBLIC PkgConfig::CRYPTO)
2643
2644 # openssl
2645 target_link_libraries(libnetdata PUBLIC PkgConfig::TLS)
2646
2647 # mnl
2648 if(NOT OS_MACOS)
2649 pkg_check_modules(MNL libmnl)
2650 if(MNL_FOUND)
2651 set(HAVE_LIBMNL True)
2652 endif()
2653 endif()
2654
2655 #
2656 # mqtt library
2657 #
2658 set(ENABLE_MQTTWEBSOCKETS True)
2659 if(ENABLE_MQTTWEBSOCKETS)
2660 add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
2661
2662 target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC
2663 -DRBUF_CUSTOM_MALLOC
2664 -DMQTT_WSS_CPUSTATS)
2665
2666 target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers)
2667
2668 target_link_libraries(mqttwebsockets PRIVATE libnetdata)
2669
2670 endif()
2671
2672 #
2673 # proto definitions
2674 #
2675 # aclk-schemas moved to Buf v2 (PR netdata/aclk-schemas#57): the module root is
2676 # now "proto/" and internal imports are relative to it (e.g. "aclk/v1/lib.proto"),
2677 # so protoc's include root must be the proto/ directory. Generated headers are
2678 # therefore included without the "proto/" prefix (e.g. "aclk/v1/lib.pb.h").
2679 netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas/proto"
2680 "${CMAKE_BINARY_DIR}/src/aclk/aclk-schemas"
2681 ACLK_PROTO_BUILT_SRCS
2682 ACLK_PROTO_BUILT_HDRS
2683 ${ACLK_PROTO_DEFS})
2684
2685 list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS}
2686 ${ACLK_PROTO_BUILT_HDRS})
2687
2688 #
2689 # nd-run helper program
2690 #
2691
2692 if(OS_LINUX)
2693 pkg_check_modules(CAP IMPORTED_TARGET libcap)
2694 else()
2695 set(CAP_FOUND False)
2696 endif()
2697
2698 if(CAP_FOUND)
2699 set(HAVE_CAPABILITY True)
2700 endif()
2701
2702 set(NDRUN_FILES src/collectors/utils/nd-run.c)
2703 add_executable(nd-run ${NDRUN_FILES})
2704 if(CAP_FOUND)
2705 target_link_libraries(nd-run PRIVATE PkgConfig::CAP)
2706 endif()
2707 target_include_directories(nd-run PRIVATE ${CONFIG_H_DIR})
2708 install(TARGETS nd-run
2709 COMPONENT netdata
2710 DESTINATION "${BINDIR}")
2711
2712 #
2713 # build plugins
2714 #
2715
2716 if(ENABLE_PLUGIN_DEBUGFS)
2717 # Define debugfs.plugin source files
2718 set(DEBUGFS_PLUGIN_FILES
2719 src/collectors/debugfs.plugin/debugfs_plugin.c
2720 src/collectors/debugfs.plugin/debugfs_plugin.h
2721 src/collectors/debugfs.plugin/module-numa-extfrag.c
2722 src/collectors/debugfs.plugin/module-zswap.c
2723 src/collectors/debugfs.plugin/module-devices-powercap.c
2724 src/collectors/debugfs.plugin/module-libsensors.c
2725 src/collectors/debugfs.plugin/module-audit.c
2726 )
2727
2728 # Add executable for debugfs.plugin
2729 add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES})
2730
2731 # Add vendored libsensors library
2732 add_subdirectory(src/collectors/debugfs.plugin/libsensors)
2733
2734 # Link debugfs.plugin with vendored libsensors
2735 target_link_libraries(debugfs.plugin PRIVATE vendored_libsensors)
2736
2737 # Include vendored libsensors headers
2738 target_include_directories(debugfs.plugin PRIVATE
2739 src/collectors/debugfs.plugin/libsensors/vendored/lib
2740 ${CMAKE_CURRENT_BINARY_DIR}/src/collectors/debugfs.plugin/libsensors # For generated headers
2741 )
2742
2743 # Link against libnetdata and optionally libcap
2744 target_link_libraries(debugfs.plugin PRIVATE libnetdata ${CAP_LIBRARIES})
2745 target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS})
2746 target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER})
2747
2748 # Install the debugfs.plugin binary
2749 install(TARGETS debugfs.plugin
2750 COMPONENT plugin-debugfs
2751 DESTINATION usr/libexec/netdata/plugins.d)
2752
2753 install(FILES
2754 src/collectors/debugfs.plugin/libsensors/vendored/etc/sensors.conf.default
2755 COMPONENT plugin-debugfs
2756 DESTINATION usr/lib/netdata/conf.d
2757 RENAME sensors3.conf)
2758
2759 # Install additional packaging files if building for packaging
2760 if(BUILD_FOR_PACKAGING)
2761 install(FILES
2762 ${PKG_FILES_PATH}/copyright
2763 COMPONENT plugin-debugfs
2764 DESTINATION usr/share/doc/netdata-plugin-debugfs)
2765 endif()
2766 endif()
2767
2768 add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c)
2769 target_link_libraries(spawn-tester libnetdata)
2770
2771 if(ENABLE_PLUGIN_APPS)
2772 set(APPS_PLUGIN_FILES
2773 src/collectors/apps.plugin/apps_plugin.c
2774 src/collectors/apps.plugin/apps_plugin.h
2775 src/collectors/apps.plugin/apps_functions.c
2776 src/collectors/apps.plugin/apps_targets.c
2777 src/collectors/apps.plugin/apps_output.c
2778 src/collectors/apps.plugin/apps_pid_files.c
2779 src/collectors/apps.plugin/apps_pid.c
2780 src/collectors/apps.plugin/apps_aggregations.c
2781 src/collectors/apps.plugin/apps_os_linux.c
2782 src/collectors/apps.plugin/apps_os_freebsd.c
2783 src/collectors/apps.plugin/apps_os_macos.c
2784 src/collectors/apps.plugin/apps_os_windows.c
2785 src/collectors/apps.plugin/apps_incremental_collection.c
2786 src/collectors/apps.plugin/apps_os_windows_nt.c
2787 src/collectors/apps.plugin/apps_pid_match.c
2788 )
2789
2790 add_executable(apps.plugin ${APPS_PLUGIN_FILES})
2791
2792 target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES}
2793 "$<$<BOOL:${OS_WINDOWS}>:Version;ntdll>")
2794
2795 target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS})
2796 target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER})
2797
2798 install(TARGETS apps.plugin
2799 COMPONENT plugin-apps
2800 DESTINATION usr/libexec/netdata/plugins.d)
2801
2802 install(FILES src/collectors/apps.plugin/apps_groups.conf
2803 COMPONENT plugin-apps
2804 DESTINATION usr/lib/netdata/conf.d)
2805
2806 if(BUILD_FOR_PACKAGING)
2807 install(FILES
2808 ${PKG_FILES_PATH}/copyright
2809 COMPONENT plugin-apps
2810 DESTINATION usr/share/doc/netdata-plugin-apps)
2811 endif()
2812 endif()
2813
2814 if(ENABLE_PLUGIN_FREEIPMI)
2815 pkg_check_modules(IPMI REQUIRED libipmimonitoring)
2816
2817 set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c)
2818
2819 add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES})
2820 target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES})
2821 target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS})
2822 target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER})
2823
2824 install(TARGETS freeipmi.plugin
2825 COMPONENT plugin-freeipmi
2826 DESTINATION usr/libexec/netdata/plugins.d)
2827
2828 if(BUILD_FOR_PACKAGING)
2829 install(FILES
2830 ${PKG_FILES_PATH}/copyright
2831 COMPONENT plugin-freeipmi
2832 DESTINATION usr/share/doc/netdata-plugin-freeipmi)
2833 endif()
2834 endif()
2835
2836 if(ENABLE_PLUGIN_NFACCT)
2837 if (NOT MNL_FOUND)
2838 message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.")
2839 endif()
2840
2841 pkg_check_modules(NFACCT REQUIRED libnetfilter_acct)
2842
2843 set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c)
2844
2845 add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES})
2846 target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES})
2847 target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS})
2848 target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER})
2849
2850 install(TARGETS nfacct.plugin
2851 COMPONENT plugin-nfacct
2852 DESTINATION usr/libexec/netdata/plugins.d)
2853
2854 if(BUILD_FOR_PACKAGING)
2855 install(FILES
2856 ${PKG_FILES_PATH}/copyright
2857 COMPONENT plugin-nfacct
2858 DESTINATION usr/share/doc/netdata-plugin-nfacct)
2859 endif()
2860 endif()
2861
2862 if(ENABLE_PLUGIN_XENSTAT)
2863 pkg_check_modules(XENSTAT REQUIRED xenstat)
2864 pkg_check_modules(XENLIGHT REQUIRED xenlight)
2865
2866 set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c)
2867
2868 add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES})
2869 target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES})
2870 target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS})
2871 target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER})
2872
2873 install(TARGETS xenstat.plugin
2874 COMPONENT plugin-xenstat
2875 DESTINATION usr/libexec/netdata/plugins.d)
2876
2877 if(BUILD_FOR_PACKAGING)
2878 install(FILES
2879 ${PKG_FILES_PATH}/copyright
2880 COMPONENT plugin-xenstat
2881 DESTINATION usr/share/doc/netdata-plugin-xenstat)
2882 endif()
2883 endif()
2884
2885 if(ENABLE_PLUGIN_PERF)
2886 set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c)
2887
2888 add_executable(perf.plugin ${PERF_PLUGIN_FILES})
2889 target_link_libraries(perf.plugin libnetdata)
2890
2891 install(TARGETS perf.plugin
2892 COMPONENT plugin-perf
2893 DESTINATION usr/libexec/netdata/plugins.d)
2894
2895 if(BUILD_FOR_PACKAGING)
2896 install(FILES
2897 ${PKG_FILES_PATH}/copyright
2898 COMPONENT plugin-perf
2899 DESTINATION usr/share/doc/netdata-plugin-perf)
2900 endif()
2901 endif()
2902
2903 if(ENABLE_PLUGIN_SLABINFO)
2904 set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c)
2905
2906 add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES})
2907 target_link_libraries(slabinfo.plugin libnetdata)
2908
2909 install(TARGETS slabinfo.plugin
2910 COMPONENT plugin-slabinfo
2911 DESTINATION usr/libexec/netdata/plugins.d)
2912
2913 if(BUILD_FOR_PACKAGING)
2914 install(FILES
2915 ${PKG_FILES_PATH}/copyright
2916 COMPONENT plugin-slabinfo
2917 DESTINATION usr/share/doc/netdata-plugin-slabinfo)
2918 endif()
2919 endif()
2920
2921
2922 if(ENABLE_PLUGIN_CUPS)
2923 pkg_check_modules(CUPS libcups)
2924 if(NOT CUPS_FOUND)
2925 pkg_check_modules(CUPS cups)
2926 if(NOT CUPS_FOUND)
2927 find_program(CUPS_CONFIG cups-config)
2928 if(CUPS_CONFIG)
2929 execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
2930 if(CUPS_API_VERSION VERSION_LESS "1.7")
2931 set(CUPS_FOUND False)
2932 else()
2933 execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE)
2934 execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
2935 set(CUPS_FOUND True)
2936 endif()
2937 endif()
2938 endif()
2939 endif()
2940
2941 if(NOT CUPS_FOUND)
2942 message(WARNING "Could not find cups cflags and libs.")
2943 else()
2944 set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c)
2945 add_executable(cups.plugin ${CUPS_PLUGIN_FILES})
2946 target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES})
2947 target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER})
2948
2949 install(TARGETS cups.plugin
2950 COMPONENT plugin-cups
2951 DESTINATION usr/libexec/netdata/plugins.d)
2952
2953 if(BUILD_FOR_PACKAGING)
2954 install(FILES
2955 ${PKG_FILES_PATH}/copyright
2956 COMPONENT plugin-cups
2957 DESTINATION usr/share/doc/netdata-plugin-cups)
2958 endif()
2959 endif()
2960 endif()
2961
2962 if(NEED_NDSUDO)
2963 set(NDSUDO_FILES src/collectors/utils/ndsudo.c)
2964
2965 add_executable(ndsudo ${NDSUDO_FILES})
2966
2967 install(TARGETS ndsudo
2968 COMPONENT netdata
2969 DESTINATION usr/libexec/netdata/plugins.d)
2970 set_source_files_properties(${NDSUDO_FILES} PROPERTIES COMPILE_OPTIONS "-Wno-unused-result")
2971 endif()
2972
2973 if(ENABLE_PLUGIN_CGROUP_NETWORK)
2974 set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c)
2975
2976 add_executable(cgroup-network ${CGROUP_NETWORK_FILES})
2977 target_link_libraries(cgroup-network libnetdata)
2978
2979 install(TARGETS cgroup-network
2980 COMPONENT netdata
2981 DESTINATION usr/libexec/netdata/plugins.d)
2982 endif()
2983
2984 # Enable rust implementation if we don't have systemd and we want the journal plugin
2985 if(ENABLE_PLUGIN_SYSTEMD_JOURNAL AND NOT SYSTEMD_FOUND)
2986 if (NOT ENABLE_NETDATA_JOURNAL_FILE_READER)
2987 message(WARNING "Systemd journal package not found, will try netdata's journal reader which requires cargo.")
2988 set(ENABLE_NETDATA_JOURNAL_FILE_READER True)
2989 endif()
2990 endif()
2991
2992 if(ENABLE_PLUGIN_SYSTEMD_JOURNAL)
2993 add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES})
2994
2995 if(ENABLE_NETDATA_JOURNAL_FILE_READER)
2996 target_compile_definitions(systemd-journal.plugin PRIVATE HAVE_RUST_PROVIDER)
2997 target_link_libraries(systemd-journal.plugin journal_reader_ffi)
2998 endif()
2999
3000 target_link_libraries(systemd-journal.plugin libnetdata)
3001
3002 install(TARGETS systemd-journal.plugin
3003 COMPONENT plugin-systemd-journal
3004 DESTINATION usr/libexec/netdata/plugins.d)
3005
3006 if(BUILD_FOR_PACKAGING)
3007 install(FILES
3008 ${PKG_FILES_PATH}/copyright
3009 COMPONENT plugin-systemd-journal
3010 DESTINATION usr/share/doc/netdata-plugin-systemd-journal)
3011 endif()
3012 endif()
3013
3014 if(ENABLE_PLUGIN_SYSTEMD_UNITS)
3015 if(NOT SYSTEMD_FOUND)
3016 message(FATAL_ERROR "Systemd units plugin requires systemd, but systemd was not found.")
3017 endif()
3018
3019 if(SYSTEMD_VERSION LESS 221)
3020 message(FATAL_ERROR "Systemd units plugin requires systemd 221 or newer, but only systemd ${SYSTEMD_VERSION} was found.")
3021 endif()
3022
3023 include(FetchContent)
3024
3025 add_executable(systemd-units.plugin ${SYSTEMD_UNITS_PLUGIN_FILES})
3026 target_link_libraries(systemd-units.plugin libnetdata)
3027
3028 install(TARGETS systemd-units.plugin
3029 COMPONENT plugin-systemd-units
3030 DESTINATION usr/libexec/netdata/plugins.d)
3031
3032 if(BUILD_FOR_PACKAGING)
3033 install(FILES
3034 ${PKG_FILES_PATH}/copyright
3035 COMPONENT plugin-systemd-units
3036 DESTINATION usr/share/doc/netdata-plugin-systemd-units)
3037 endif()
3038 endif()
3039
3040 if(OS_WINDOWS)
3041 add_executable(windows-events.plugin ${WINDOWS_EVENTS_PLUGIN_FILES})
3042 target_link_libraries(windows-events.plugin libnetdata wevtapi)
3043
3044 install(TARGETS windows-events.plugin
3045 COMPONENT plugin-windows-events
3046 DESTINATION usr/libexec/netdata/plugins.d)
3047 endif()
3048
3049 if(ENABLE_PLUGIN_EBPF)
3050 set(EBPF_PLUGIN_FILES
3051 src/collectors/ebpf.plugin/ebpf.c
3052 src/collectors/ebpf.plugin/ebpf.h
3053 src/collectors/ebpf.plugin/ebpf_cachestat.c
3054 src/collectors/ebpf.plugin/ebpf_cachestat.h
3055 src/collectors/ebpf.plugin/ebpf_dcstat.c
3056 src/collectors/ebpf.plugin/ebpf_dcstat.h
3057 src/collectors/ebpf.plugin/ebpf_disk.c
3058 src/collectors/ebpf.plugin/ebpf_disk.h
3059 src/collectors/ebpf.plugin/ebpf_fd.c
3060 src/collectors/ebpf.plugin/ebpf_fd.h
3061 src/collectors/ebpf.plugin/ebpf_hardirq.c
3062 src/collectors/ebpf.plugin/ebpf_hardirq.h
3063 src/collectors/ebpf.plugin/ebpf_mdflush.c
3064 src/collectors/ebpf.plugin/ebpf_mdflush.h
3065 src/collectors/ebpf.plugin/ebpf_mount.c
3066 src/collectors/ebpf.plugin/ebpf_mount.h
3067 src/collectors/ebpf.plugin/ebpf_filesystem.c
3068 src/collectors/ebpf.plugin/ebpf_filesystem.h
3069 src/collectors/ebpf.plugin/ebpf_oomkill.c
3070 src/collectors/ebpf.plugin/ebpf_oomkill.h
3071 src/collectors/ebpf.plugin/ebpf_process.c
3072 src/collectors/ebpf.plugin/ebpf_process.h
3073 src/collectors/ebpf.plugin/ebpf_shm.c
3074 src/collectors/ebpf.plugin/ebpf_shm.h
3075 src/collectors/ebpf.plugin/ebpf_socket.c
3076 src/collectors/ebpf.plugin/ebpf_socket.h
3077 src/collectors/ebpf.plugin/ebpf_socket_ipc.c
3078 src/collectors/ebpf.plugin/ebpf_socket_ipc.h
3079 src/collectors/ebpf.plugin/ebpf_softirq.c
3080 src/collectors/ebpf.plugin/ebpf_softirq.h
3081 src/collectors/ebpf.plugin/ebpf_sync.c
3082 src/collectors/ebpf.plugin/ebpf_sync.h
3083 src/collectors/ebpf.plugin/ebpf_swap.c
3084 src/collectors/ebpf.plugin/ebpf_swap.h
3085 src/collectors/ebpf.plugin/ebpf_vfs.c
3086 src/collectors/ebpf.plugin/ebpf_vfs.h
3087 src/collectors/ebpf.plugin/ebpf_apps.c
3088 src/collectors/ebpf.plugin/ebpf_apps.h
3089 src/collectors/ebpf.plugin/ebpf_cgroup.c
3090 src/collectors/ebpf.plugin/ebpf_cgroup.h
3091 src/collectors/ebpf.plugin/ebpf_unittest.c
3092 src/collectors/ebpf.plugin/ebpf_unittest.h
3093 src/collectors/ebpf.plugin/ebpf_functions.c
3094 src/collectors/ebpf.plugin/ebpf_functions.h
3095 src/collectors/ebpf.plugin/libbpf_api/ebpf.c
3096 src/collectors/ebpf.plugin/libbpf_api/ebpf.h
3097 src/collectors/ebpf.plugin/libbpf_api/ebpf_library.c
3098 src/collectors/ebpf.plugin/libbpf_api/ebpf_library.h
3099 )
3100
3101 add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES} ${INTERCOMMUNICATION_COLLECTORS_FILES})
3102 target_link_libraries(ebpf.plugin libnetdata)
3103
3104 netdata_add_libbpf_to_target(ebpf.plugin)
3105 netdata_add_ebpf_co_re_to_target(ebpf.plugin)
3106
3107 install(TARGETS ebpf.plugin
3108 COMPONENT plugin-ebpf
3109 DESTINATION usr/libexec/netdata/plugins.d)
3110
3111 install(FILES
3112 src/collectors/ebpf.plugin/ebpf.d.conf
3113 COMPONENT plugin-ebpf
3114 DESTINATION usr/lib/netdata/conf.d)
3115
3116 install(FILES
3117 src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
3118 src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
3119 src/collectors/ebpf.plugin/ebpf.d/disk.conf
3120 src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt
3121 src/collectors/ebpf.plugin/ebpf.d/fd.conf
3122 src/collectors/ebpf.plugin/ebpf.d/filesystem.conf
3123 src/collectors/ebpf.plugin/ebpf.d/hardirq.conf
3124 src/collectors/ebpf.plugin/ebpf.d/mdflush.conf
3125 src/collectors/ebpf.plugin/ebpf.d/mount.conf
3126 src/collectors/ebpf.plugin/ebpf.d/network.conf
3127 src/collectors/ebpf.plugin/ebpf.d/oomkill.conf
3128 src/collectors/ebpf.plugin/ebpf.d/process.conf
3129 src/collectors/ebpf.plugin/ebpf.d/shm.conf
3130 src/collectors/ebpf.plugin/ebpf.d/softirq.conf
3131 src/collectors/ebpf.plugin/ebpf.d/swap.conf
3132 src/collectors/ebpf.plugin/ebpf.d/sync.conf
3133 src/collectors/ebpf.plugin/ebpf.d/vfs.conf
3134 COMPONENT plugin-ebpf
3135 DESTINATION usr/lib/netdata/conf.d/ebpf.d)
3136
3137 if(BUILD_FOR_PACKAGING)
3138 install(FILES
3139 ${PKG_FILES_PATH}/copyright
3140 COMPONENT plugin-ebpf
3141 DESTINATION usr/share/doc/netdata-plugin-ebpf)
3142 endif()
3143
3144 if(ENABLE_LEGACY_EBPF_PROGRAMS)
3145 netdata_install_legacy_ebpf_code()
3146 endif()
3147 endif()
3148
3149 if(ENABLE_PLUGIN_LOCAL_LISTENERS)
3150 set(LOCAL_LISTENERS_FILES
3151 src/collectors/utils/local_listeners.c
3152 src/libnetdata/local-sockets/local-sockets.h
3153 )
3154
3155 add_executable(local-listeners ${LOCAL_LISTENERS_FILES})
3156
3157 target_compile_options(local-listeners PRIVATE
3158 "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
3159 target_include_directories(local-listeners PRIVATE
3160 "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
3161 target_link_libraries(local-listeners libnetdata
3162 "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
3163
3164 install(TARGETS local-listeners
3165 COMPONENT netdata
3166 DESTINATION usr/libexec/netdata/plugins.d)
3167 endif()
3168
3169 if(ENABLE_PLUGIN_NETWORK_VIEWER)
3170 if(USE_LTO AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
3171 # GCC still performs LTO when linking slim LTO static archives into a
3172 # non-LTO target. Build these archives as fat objects and force a
3173 # regular final link to avoid exhausting the i386 linker.
3174 if(TARGET judy)
3175 target_compile_options(judy PRIVATE -ffat-lto-objects)
3176 endif()
3177 if(TARGET libnetdata)
3178 target_compile_options(libnetdata PRIVATE -ffat-lto-objects)
3179 endif()
3180 endif()
3181
3182 set(NETWORK_VIEWER_FILES)
3183 if(OS_LINUX)
3184 list(APPEND NETWORK_VIEWER_FILES
3185 src/libnetdata/local-sockets/local-sockets.h
3186 src/collectors/network-viewer.plugin/network-viewer.c
3187 )
3188 endif()
3189 if(OS_WINDOWS)
3190 list(APPEND NETWORK_VIEWER_FILES
3191 src/collectors/network-viewer.plugin/network-viewer-windows.c
3192 )
3193 endif()
3194 if(OS_FREEBSD)
3195 list(APPEND NETWORK_VIEWER_FILES
3196 src/libnetdata/local-sockets/local-sockets-freebsd.h
3197 src/collectors/network-viewer.plugin/network-viewer.c
3198 )
3199 endif()
3200
3201 add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES})
3202 if(USE_LTO AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
3203 set_property(TARGET network-viewer.plugin PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
3204 target_link_options(network-viewer.plugin PRIVATE -fno-lto)
3205 endif()
3206
3207 target_compile_options(network-viewer.plugin PRIVATE
3208 "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
3209 target_include_directories(network-viewer.plugin PRIVATE
3210 "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
3211 target_link_libraries(network-viewer.plugin libnetdata
3212 "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
3213
3214 install(TARGETS network-viewer.plugin
3215 COMPONENT plugin-network-viewer
3216 DESTINATION usr/libexec/netdata/plugins.d)
3217
3218 if(BUILD_FOR_PACKAGING)
3219 install(FILES
3220 ${PKG_FILES_PATH}/copyright
3221 COMPONENT plugin-network-viewer
3222 DESTINATION usr/share/doc/netdata-plugin-network-viewer)
3223 endif()
3224 endif()
3225
3226 #
3227 # exporters
3228 #
3229
3230 if(ENABLE_EXPORTER_MONGODB)
3231 pkg_check_modules(MONGOC libmongoc-1.0>=1.7)
3232
3233 if(MONGOC_FOUND)
3234 SET(HAVE_MONGOC True)
3235 else()
3236 SET(ENABLE_EXPORTER_MONGODB False)
3237 endif()
3238 endif()
3239
3240 if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
3241 pkg_check_modules(SNAPPY snappy)
3242 if (NOT SNAPPY_FOUND)
3243 include(CheckLibraryExists)
3244 check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
3245
3246 if(HAVE_SNAPPY_LIB)
3247 set(SNAPPY_INCLUDE_DIRS "")
3248 set(SNAPPY_CFLAGS_OTHER "")
3249 set(SNAPPY_LIBRARIES "-lsnappy")
3250 else()
3251 message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.")
3252 endif()
3253 endif()
3254
3255 netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
3256 "${CMAKE_BINARY_DIR}/src/exporting/prometheus/remote_write"
3257 PROMETHEUS_REMOTE_WRITE_BUILT_SRCS
3258 PROMETHEUS_REMOTE_WRITE_BUILT_HDRS
3259 "src/exporting/prometheus/remote_write/remote_write.proto")
3260
3261 list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
3262 ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS}
3263 ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS})
3264
3265 set(ENABLE_PROMETHEUS_REMOTE_WRITE True)
3266 endif()
3267
3268 #
3269 # build netdata (only Linux ATM)
3270 #
3271
3272 if(OS_WINDOWS)
3273 set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
3274 configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY)
3275
3276 set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc")
3277 configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY)
3278
3279 set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
3280 configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
3281
3282 configure_file(packaging/windows/netdata.wxs.in netdata.wxs @ONLY)
3283 configure_file(packaging/windows/NetdataWhite.ico NetdataWhite.ico COPYONLY)
3284 configure_file(packaging/windows/eula.rtf eula.rtf COPYONLY)
3285 configure_file(packaging/windows/Top.bmp Top.bmp COPYONLY)
3286 configure_file(packaging/windows/BackGround.bmp BackGround.bmp COPYONLY)
3287 configure_file(src/collectors/windows.plugin/driver/netdata_driver.inf netdata_driver.inf COPYONLY)
3288 endif()
3289
3290 add_executable(netdata
3291 ${NETDATA_FILES}
3292 "${ACLK_FILES}"
3293 "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
3294 "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
3295 "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>"
3296 )
3297
3298 if(ENABLE_ML)
3299 netdata_add_dlib_to_target(netdata)
3300 endif()
3301
3302 if(OS_WINDOWS)
3303 add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
3304 target_link_libraries(NetdataClaim shell32 gdi32 msftedit)
3305 target_compile_options(NetdataClaim PUBLIC -mwindows)
3306
3307 set(NETDATA_DRIVER_FILE "${CMAKE_BINARY_DIR}/netdata_driver.sys")
3308 set(NETDATA_DRIVER_FILE_INF "${CMAKE_BINARY_DIR}/netdata_driver.inf")
3309
3310 add_library(netdata_driver SHARED ${WINDOWS_PLUGIN_DRIVER})
3311 set_target_properties(netdata_driver PROPERTIES LIBRARY_OUTPUT_NAME "netdata_driver")
3312 set_target_properties(netdata_driver PROPERTIES PREFIX "")
3313 set_target_properties(netdata_driver PROPERTIES SUFFIX ".sys")
3314 target_include_directories(netdata_driver PRIVATE BEFORE "/mingw64/include/ddk" "${CMAKE_SOURCE_DIR}/src/collectors/windows.plugin" "${CMAKE_SOURCE_DIR}/src/collectors/windows.plugin/driver")
3315 target_compile_options(netdata_driver PRIVATE
3316 -Wall
3317 -Wextra
3318 -Werror
3319 -ffreestanding
3320 -fno-exceptions
3321 -fno-stack-protector
3322 -fshort-wchar
3323 -mno-red-zone
3324 )
3325 target_link_options(netdata_driver PRIVATE
3326 -Wl,--entry,DriverEntry@8
3327 -nostdlib
3328 -Wl,--subsystem,native
3329 -Wl,--image-base,0x10000
3330 )
3331 target_link_libraries(netdata_driver kernel32 ntoskrnl)
3332
3333 install(FILES "${NETDATA_DRIVER_FILE}"
3334 COMPONENT netdata_driver
3335 DESTINATION "${BINDIR}")
3336
3337 install(FILES "${NETDATA_DRIVER_FILE_INF}"
3338 COMPONENT netdata_driver_inf
3339 DESTINATION "${BINDIR}")
3340 endif()
3341
3342 target_compile_options(netdata PRIVATE
3343 "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_CFLAGS_OTHER}>"
3344 "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_CFLAGS_OTHER}>"
3345 )
3346
3347 target_include_directories(netdata PRIVATE
3348 "${CMAKE_BINARY_DIR}/src/aclk/aclk-schemas"
3349 "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
3350 "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
3351 )
3352
3353 target_link_libraries(netdata PRIVATE
3354 m
3355 libnetdata
3356 "$<$<BOOL:${OS_LINUX}>:rt>"
3357 "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:mqttwebsockets>"
3358 "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_LIBRARIES}>"
3359 "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_LIBRARIES}>"
3360 "$<$<BOOL:${OS_MACOS}>:${IOKIT};${FOUNDATION}>"
3361 "$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
3362 "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
3363 "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>"
3364 "$<$<BOOL:${OS_WINDOWS}>:odbc32;setupapi>"
3365 )
3366
3367 netdata_add_protobuf(netdata)
3368
3369 #
3370 # build systemd-cat-native
3371 #
3372 set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c
3373 src/libnetdata/log/systemd-cat-native.h)
3374
3375 add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES})
3376 target_link_libraries(systemd-cat-native
3377 libnetdata
3378 "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>"
3379 )
3380
3381 install(TARGETS systemd-cat-native
3382 COMPONENT netdata
3383 DESTINATION "${BINDIR}")
3384
3385 #
3386 # build log2journal
3387 #
3388
3389 pkg_check_modules(PCRE2 libpcre2-8)
3390
3391 if(PCRE2_FOUND)
3392 set(LOG2JOURNAL_FILES
3393 ${CONFIG_H}
3394 src/collectors/log2journal/log2journal.h
3395 src/collectors/log2journal/log2journal.c
3396 src/collectors/log2journal/log2journal-help.c
3397 src/collectors/log2journal/log2journal-yaml.c
3398 src/collectors/log2journal/log2journal-json.c
3399 src/collectors/log2journal/log2journal-logfmt.c
3400 src/collectors/log2journal/log2journal-pcre2.c
3401 src/collectors/log2journal/log2journal-params.c
3402 src/collectors/log2journal/log2journal-inject.c
3403 src/collectors/log2journal/log2journal-pattern.c
3404 src/collectors/log2journal/log2journal-replace.c
3405 src/collectors/log2journal/log2journal-rename.c
3406 src/collectors/log2journal/log2journal-rewrite.c
3407 src/collectors/log2journal/log2journal-txt.h
3408 src/collectors/log2journal/log2journal-hashed-key.h
3409 )
3410
3411 add_executable(log2journal ${LOG2JOURNAL_FILES})
3412 target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS})
3413 target_compile_options(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER})
3414
3415 target_link_libraries(log2journal PUBLIC libnetdata)
3416 target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}")
3417 netdata_add_libyaml_to_target(log2journal)
3418
3419 install(TARGETS log2journal
3420 COMPONENT netdata
3421 DESTINATION "${BINDIR}")
3422
3423 install(DIRECTORY src/collectors/log2journal/log2journal.d
3424 COMPONENT netdata
3425 DESTINATION usr/lib/netdata/conf.d)
3426 endif()
3427
3428 #
3429 # build netdatacli
3430 #
3431
3432 set(NETDATACLI_FILES
3433 src/daemon/commands.h
3434 src/daemon/pipename.c
3435 src/daemon/pipename.h
3436 src/cli/cli.c
3437 )
3438
3439 add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>")
3440 target_link_libraries(netdatacli libnetdata)
3441
3442 install(TARGETS netdatacli
3443 COMPONENT netdata
3444 DESTINATION "${BINDIR}")
3445
3446 #
3447 # Build go.d.plugin
3448 #
3449
3450 if(ENABLE_PLUGIN_GO)
3451 if (OS_WINDOWS)
3452 set(GO_PLUGIN_BIN go.d.plugin.exe)
3453 else()
3454 set(GO_PLUGIN_BIN go.d.plugin)
3455 endif()
3456
3457 add_go_target(go-plugin ${GO_PLUGIN_BIN} src/go cmd/godplugin)
3458
3459 install(PROGRAMS ${CMAKE_BINARY_DIR}/${GO_PLUGIN_BIN}
3460 COMPONENT plugin-go
3461 DESTINATION usr/libexec/netdata/plugins.d)
3462
3463 # Build and install nd-mcp (stdio-golang bridge) exactly like go.d.plugin
3464 if(ENABLE_ND_MCP)
3465 if (OS_WINDOWS)
3466 set(ND_MCP_NAME nd-mcp.exe)
3467 else()
3468 set(ND_MCP_NAME nd-mcp)
3469 endif()
3470
3471 add_go_target(nd-mcp-target ${ND_MCP_NAME} src/web/mcp/bridges/stdio-golang .)
3472 install(PROGRAMS
3473 ${CMAKE_BINARY_DIR}/${ND_MCP_NAME}
3474 COMPONENT plugin-go
3475 DESTINATION "${BINDIR}")
3476 endif()
3477 endif()
3478
3479 #
3480 # Build scripts.d.plugin
3481 #
3482
3483 if(ENABLE_PLUGIN_SCRIPTS)
3484 if (OS_WINDOWS)
3485 set(SCRIPTS_PLUGIN_BIN scripts.d.plugin.exe)
3486 else()
3487 set(SCRIPTS_PLUGIN_BIN scripts.d.plugin)
3488 endif()
3489
3490 add_go_target(scripts-plugin ${SCRIPTS_PLUGIN_BIN} src/go cmd/scriptsdplugin)
3491
3492 install(PROGRAMS ${CMAKE_BINARY_DIR}/${SCRIPTS_PLUGIN_BIN}
3493 COMPONENT plugin-scripts
3494 DESTINATION usr/libexec/netdata/plugins.d)
3495
3496 install(FILES src/go/plugin/scripts.d/config/scripts.d.conf
3497 COMPONENT plugin-scripts
3498 DESTINATION usr/lib/netdata/conf.d)
3499
3500 install(DIRECTORY src/go/plugin/scripts.d/config/scripts.d
3501 COMPONENT plugin-scripts
3502 DESTINATION usr/lib/netdata/conf.d
3503 FILES_MATCHING PATTERN "*.conf")
3504 endif()
3505
3506 #
3507 # Build ibm.d.plugin
3508 #
3509
3510 if(ENABLE_PLUGIN_IBM)
3511 pkg_check_modules(ODBC REQUIRED odbc)
3512 include(NetdataIBMPlugin)
3513 add_ibm_plugin_target()
3514
3515 install(PROGRAMS ${CMAKE_BINARY_DIR}/ibm.d.plugin
3516 COMPONENT plugin-ibm
3517 DESTINATION usr/libexec/netdata/plugins.d)
3518
3519 # Install IBM plugin configuration files
3520 install(FILES src/go/plugin/ibm.d/config/ibm.d.conf
3521 COMPONENT plugin-ibm
3522 DESTINATION usr/lib/netdata/conf.d)
3523
3524 install(FILES
3525 src/go/plugin/ibm.d/config/ibm.d/as400.conf
3526 src/go/plugin/ibm.d/config/ibm.d/db2.conf
3527 src/go/plugin/ibm.d/config/ibm.d/websphere_jmx.conf
3528 src/go/plugin/ibm.d/config/ibm.d/websphere_mp.conf
3529 src/go/plugin/ibm.d/config/ibm.d/websphere_pmi.conf
3530 COMPONENT plugin-ibm
3531 DESTINATION usr/lib/netdata/conf.d/ibm.d
3532 )
3533
3534 install_ibm_runtime(plugin-ibm)
3535 endif()
3536
3537 #
3538 # otel.plugin
3539 #
3540 # Handle OTel Collector plugin
3541 #
3542 if(ENABLE_PLUGIN_OTEL)
3543 corrosion_install(TARGETS otel-plugin
3544 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
3545 RUNTIME DESTINATION usr/libexec/netdata/plugins.d
3546 COMPONENT plugin-otel)
3547
3548 install(FILES src/crates/netdata-otel/otel-plugin/configs/otel.d/v1/metrics/hostmetrics-receiver.yaml
3549 COMPONENT plugin-otel
3550 DESTINATION usr/lib/netdata/conf.d/otel.d/v1/metrics)
3551
3552 install(DIRECTORY COMPONENT plugin-otel DESTINATION etc/netdata/otel.d/v1/metrics)
3553 endif()
3554
3555 #
3556 # otel-signal-viewer
3557 #
3558 # Handle OTel signal viewer plugin
3559 if(ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER)
3560 corrosion_install(TARGETS otel-signal-viewer-plugin
3561 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
3562 RUNTIME DESTINATION usr/libexec/netdata/plugins.d
3563 COMPONENT plugin-otel-signal-viewer)
3564 endif()
3565
3566 #
3567 # netflow-plugin
3568 #
3569 # Handle NetFlow/IPFIX/sFlow flow analysis plugin
3570 if(ENABLE_PLUGIN_NETFLOW)
3571 corrosion_install(TARGETS netflow-plugin
3572 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
3573 RUNTIME DESTINATION usr/libexec/netdata/plugins.d
3574 COMPONENT plugin-netflow)
3575
3576 install(FILES src/crates/netflow-plugin/configs/netflow.yaml
3577 COMPONENT plugin-netflow
3578 DESTINATION usr/lib/netdata/conf.d)
3579
3580 if (OS_WINDOWS)
3581 set(TOPOLOGY_IP_INTEL_DOWNLOADER_BIN topology-ip-intel-downloader.exe)
3582 else()
3583 set(TOPOLOGY_IP_INTEL_DOWNLOADER_BIN topology-ip-intel-downloader)
3584 endif()
3585
3586 if(CMAKE_SIZEOF_VOID_P LESS 8)
3587 message(STATUS
3588 "plugin-netflow: skipping topology-ip-intel-downloader binary on 32-bit targets; "
3589 "stock topology-ip-intel payload installation remains enabled")
3590 else()
3591 add_go_target(topology-ip-intel-downloader-target ${TOPOLOGY_IP_INTEL_DOWNLOADER_BIN} src/go tools/topology-ip-intel-downloader)
3592 install(PROGRAMS
3593 ${CMAKE_BINARY_DIR}/${TOPOLOGY_IP_INTEL_DOWNLOADER_BIN}
3594 COMPONENT plugin-netflow
3595 DESTINATION "${BINDIR}")
3596 install(CODE "file(REMOVE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d/topology-ip-intel-downloader\")"
3597 COMPONENT plugin-netflow)
3598 install(CODE "file(REMOVE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d/topology-ip-intel-downloader.plugin\")"
3599 COMPONENT plugin-netflow)
3600 install(CODE "file(REMOVE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d/topology-ip-intel-downloader.exe\")"
3601 COMPONENT plugin-netflow)
3602 install(CODE "file(REMOVE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d/topology-ip-intel-downloader.plugin.exe\")"
3603 COMPONENT plugin-netflow)
3604 endif()
3605
3606 install(FILES src/go/tools/topology-ip-intel-downloader/configs/topology-ip-intel.yaml
3607 COMPONENT plugin-netflow
3608 DESTINATION usr/lib/netdata/conf.d)
3609
3610 if(NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR)
3611 set(TOPOLOGY_IP_INTEL_STOCK_PAYLOAD
3612 "${NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR}/README.md"
3613 "${NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR}/topology-ip-asn.mmdb"
3614 "${NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR}/topology-ip-geo.mmdb"
3615 "${NETDATA_TOPOLOGY_IP_INTEL_STOCK_DIR}/topology-ip-intel.json")
3616 foreach(stock_file IN LISTS TOPOLOGY_IP_INTEL_STOCK_PAYLOAD)
3617 if(NOT EXISTS "${stock_file}")
3618 message(FATAL_ERROR
3619 "Missing topology IP intelligence stock payload file: ${stock_file}")
3620 endif()
3621 endforeach()
3622 install(FILES
3623 ${TOPOLOGY_IP_INTEL_STOCK_PAYLOAD}
3624 COMPONENT plugin-netflow
3625 DESTINATION ${STOCK_DATA_DEST}/topology-ip-intel)
3626 else()
3627 message(STATUS
3628 "plugin-netflow: no staged topology IP intelligence stock payload provided; "
3629 "skipping stock topology-ip-intel install")
3630 endif()
3631 endif()
3632
3633 #
3634 # Generate config file
3635 #
3636
3637 # Collect all compiler flags
3638 get_directory_property(NETDATA_COMPILE_OPTIONS COMPILE_OPTIONS)
3639 get_directory_property(NETDATA_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
3640
3641 # Collect all linker flags
3642 get_directory_property(NETDATA_LINK_OPTIONS LINK_OPTIONS)
3643 get_directory_property(NETDATA_LINK_LIBRARIES LINK_LIBRARIES)
3644
3645 list(APPEND CONFIGURE_OPTIONS
3646 # Build type and languages
3647 "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
3648 "-DCMAKE_C_STANDARD=${CMAKE_C_STANDARD}"
3649 "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
3650 "-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}"
3651
3652 # Compiler flags (dynamically collected)
3653 "-DCMAKE_C_FLAGS='${CMAKE_C_FLAGS} ${NETDATA_COMPILE_OPTIONS}'"
3654 "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS} ${NETDATA_COMPILE_OPTIONS}'"
3655 "-DCMAKE_COMPILE_DEFINITIONS='${NETDATA_COMPILE_DEFINITIONS}'"
3656
3657 # Linker flags (dynamically collected)
3658 "-DCMAKE_EXE_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS} ${NETDATA_LINK_OPTIONS}'"
3659 "-DCMAKE_SHARED_LINKER_FLAGS='${CMAKE_SHARED_LINKER_FLAGS}'"
3660 )
3661
3662 string(JOIN " " CONFIGURE_COMMAND "cmake" ${CONFIGURE_OPTIONS})
3663
3664 if (NOT NETDATA_USER)
3665 set(NETDATA_USER "netdata")
3666 endif()
3667
3668 set(BUILD_INFO_CMAKE_CACHE_ARCHIVE_NAME "build-info-cmake-cache.gz")
3669 set(BUILD_INFO_CMAKE_CACHE_ARCHIVE_PATH "usr/share/netdata")
3670
3671 configure_file(packaging/cmake/config.cmake.h.in config.h)
3672
3673 #
3674 # install
3675 #
3676
3677 install(TARGETS netdata COMPONENT netdata DESTINATION "${BINDIR}")
3678
3679 install(DIRECTORY COMPONENT netdata DESTINATION var/cache/netdata)
3680 install(DIRECTORY COMPONENT netdata DESTINATION var/log/netdata)
3681 install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/registry)
3682 install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/cloud.d)
3683 install(DIRECTORY COMPONENT netdata DESTINATION var/run/netdata)
3684 install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata)
3685 install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/custom-plugins.d)
3686 install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/health.d)
3687 install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/ssl)
3688 install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/statsd.d)
3689 install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d)
3690 install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d/schema.d)
3691 install(DIRECTORY COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d)
3692 install(DIRECTORY COMPONENT netdata DESTINATION ${WEB_DEST})
3693
3694 set(libsysdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/system")
3695 set(pkglibexecdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata")
3696 set(localstatedir_POST "${NETDATA_RUNTIME_PREFIX}/var")
3697 set(sbindir_POST "${NETDATA_BIN_DIR}")
3698 set(configdir_POST "${CONFIG_DIR}")
3699 set(libconfigdir_POST "${LIBCONFIG_DIR}")
3700 set(cachedir_POST "${CACHE_DIR}")
3701 set(varlibdir_POST "${VARLIB_DIR}")
3702 set(registrydir_POST "${VARLIB_DIR}/registry")
3703 set(logdir_POST "${LOG_DIR}")
3704 set(netdata_user_POST "${NETDATA_USER}")
3705 set(netdata_group_POST "${NETDATA_USER}")
3706
3707 if(NOT OS_WINDOWS)
3708 configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
3709 install(PROGRAMS
3710 ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
3711 COMPONENT netdata
3712 DESTINATION "${BINDIR}")
3713 else()
3714 install(PROGRAMS
3715 ${CMAKE_BINARY_DIR}/NetdataClaim.exe
3716 COMPONENT netdata
3717 DESTINATION "${BINDIR}")
3718 endif()
3719
3720 #
3721 # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume
3722 # the files exists unconditionally.
3723 #
3724 configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in
3725 src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY)
3726 install(PROGRAMS
3727 ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh
3728 COMPONENT netdata
3729 DESTINATION usr/libexec/netdata/plugins.d)
3730
3731 configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in
3732 src/collectors/cgroups.plugin/cgroup-name.sh @ONLY)
3733 install(PROGRAMS
3734 ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh
3735 COMPONENT netdata
3736 DESTINATION usr/libexec/netdata/plugins.d)
3737
3738 #
3739 # otel config
3740 #
3741 if(ENABLE_PLUGIN_OTEL)
3742 configure_file(src/crates/netdata-otel/otel-plugin/configs/otel.yaml.in
3743 src/crates/netdata-otel/otel-plugin/configs/otel.yaml
3744 @ONLY)
3745
3746 install(FILES ${CMAKE_BINARY_DIR}/src/crates/netdata-otel/otel-plugin/configs/otel.yaml
3747 COMPONENT plugin-otel
3748 DESTINATION usr/lib/netdata/conf.d)
3749 endif()
3750
3751 #
3752 # otel-signal-viewer config
3753 #
3754 if(ENABLE_PLUGIN_OTEL_SIGNAL_VIEWER)
3755 configure_file(src/crates/netdata-log-viewer/otel-signal-viewer-plugin/configs/otel-signal-viewer.yaml.in
3756 src/crates/netdata-log-viewer/otel-signal-viewer-plugin/configs/otel-signal-viewer.yaml
3757 @ONLY)
3758
3759 install(FILES ${CMAKE_BINARY_DIR}/src/crates/netdata-log-viewer/otel-signal-viewer-plugin/configs/otel-signal-viewer.yaml
3760 COMPONENT plugin-otel-signal-viewer
3761 DESTINATION usr/lib/netdata/conf.d)
3762 endif()
3763
3764 #
3765 # statsd
3766 #
3767 install(FILES
3768 src/collectors/statsd.plugin/asterisk.conf
3769 src/collectors/statsd.plugin/example.conf
3770 src/collectors/statsd.plugin/k6.conf
3771 COMPONENT netdata
3772 DESTINATION usr/lib/netdata/conf.d/statsd.d)
3773
3774 #
3775 # exporting
3776 #
3777 install(FILES
3778 src/exporting/exporting.conf
3779 COMPONENT netdata
3780 DESTINATION usr/lib/netdata/conf.d)
3781
3782 #
3783 # ioping.plugin
3784 #
3785 install(FILES
3786 src/collectors/ioping.plugin/ioping.conf
3787 COMPONENT netdata
3788 DESTINATION usr/lib/netdata/conf.d)
3789
3790 #
3791 # streaming
3792 #
3793 install(FILES
3794 src/streaming/stream.conf
3795 COMPONENT netdata
3796 DESTINATION usr/lib/netdata/conf.d)
3797
3798 #
3799 # swagger
3800 #
3801 install(FILES
3802 src/web/api/netdata-swagger.json
3803 src/web/api/netdata-swagger.yaml
3804 COMPONENT netdata
3805 DESTINATION ${WEB_DEST})
3806
3807 #
3808 # service files
3809 #
3810
3811 configure_file(system/install-service.sh.in system/install-service.sh @ONLY)
3812 install(PROGRAMS
3813 ${CMAKE_BINARY_DIR}/system/install-service.sh
3814 COMPONENT netdata
3815 DESTINATION usr/libexec/netdata)
3816
3817 configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY)
3818 install(FILES
3819 ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist
3820 COMPONENT netdata
3821 DESTINATION usr/lib/netdata/system/launchd)
3822
3823 configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY)
3824 install(FILES
3825 ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata
3826 COMPONENT netdata
3827 DESTINATION usr/lib/netdata/system/freebsd/rc.d)
3828
3829 configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY)
3830 install(FILES
3831 ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata
3832 COMPONENT netdata
3833 DESTINATION usr/lib/netdata/system/initd/init.d)
3834
3835 configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY)
3836 install(FILES
3837 ${CMAKE_BINARY_DIR}/system/logrotate/netdata
3838 COMPONENT netdata
3839 DESTINATION usr/lib/netdata/system/logrotate)
3840 install(FILES
3841 ${CMAKE_BINARY_DIR}/system/logrotate/netdata
3842 COMPONENT netdata
3843 DESTINATION etc/logrotate.d)
3844
3845 configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY)
3846 install(FILES
3847 ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata
3848 COMPONENT netdata
3849 DESTINATION usr/lib/netdata/system/lsb/init.d)
3850
3851 configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY)
3852 install(FILES
3853 ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata
3854 COMPONENT netdata
3855 DESTINATION usr/lib/netdata/system/openrc/conf.d)
3856
3857 configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY)
3858 install(FILES
3859 ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata
3860 COMPONENT netdata
3861 DESTINATION usr/lib/netdata/system/openrc/init.d)
3862
3863 configure_file(system/runit/run.in system/runit/run @ONLY)
3864 install(FILES
3865 ${CMAKE_BINARY_DIR}/system/runit/run
3866 COMPONENT netdata
3867 DESTINATION usr/lib/netdata/system/runit)
3868
3869 configure_file(system/dinit/netdata.in system/dinit/netdata @ONLY)
3870 install(FILES
3871 ${CMAKE_BINARY_DIR}/system/dinit/netdata
3872 COMPONENT netdata
3873 DESTINATION usr/lib/netdata/system/dinit)
3874
3875 configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY)
3876 install(FILES
3877 ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
3878 COMPONENT netdata
3879 DESTINATION usr/lib/netdata/system/systemd)
3880
3881 install(FILES
3882 system/systemd/journald@netdata.conf
3883 COMPONENT netdata
3884 DESTINATION usr/lib/netdata/system/systemd)
3885
3886 configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY)
3887 install(FILES
3888 ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235
3889 COMPONENT netdata
3890 DESTINATION usr/lib/netdata/system/systemd)
3891
3892 configure_file(system/systemd/sysusers.conf.in system/systemd/sysusers/netdata.conf @ONLY)
3893 install(FILES
3894 ${CMAKE_BINARY_DIR}/system/systemd/sysusers/netdata.conf
3895 COMPONENT netdata
3896 DESTINATION usr/lib/netdata/system/systemd/sysusers)
3897
3898 configure_file(system/systemd/tmpfiles.conf.in system/systemd/tmpfiles/netdata.conf @ONLY)
3899 install(FILES
3900 ${CMAKE_BINARY_DIR}/system/systemd/tmpfiles/netdata.conf
3901 COMPONENT netdata
3902 DESTINATION usr/lib/netdata/system/systemd/tmpfiles)
3903
3904 if(BUILD_FOR_PACKAGING)
3905 install(FILES
3906 ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
3907 COMPONENT netdata
3908 DESTINATION lib/systemd/system)
3909 install(FILES
3910 ${CMAKE_BINARY_DIR}/system/systemd/sysusers/netdata.conf
3911 COMPONENT user
3912 DESTINATION usr/lib/sysusers.d)
3913 install(FILES
3914 ${CMAKE_BINARY_DIR}/system/systemd/tmpfiles/netdata.conf
3915 COMPONENT netdata
3916 DESTINATION usr/lib/tmpfiles.d)
3917 install(DIRECTORY
3918 COMPONENT netdata
3919 DESTINATION usr/lib/systemd/journald@netdata.conf.d)
3920 install(FILES
3921 system/systemd/journald@netdata.conf
3922 COMPONENT netdata
3923 DESTINATION usr/lib/systemd/journald@netdata.conf.d
3924 RENAME netdata.conf)
3925 endif()
3926
3927 install(FILES
3928 system/systemd/50-netdata.preset
3929 COMPONENT netdata
3930 DESTINATION usr/lib/netdata/system/systemd)
3931
3932 install(FILES
3933 system/vnodes/vnodes.conf
3934 COMPONENT netdata
3935 DESTINATION usr/lib/netdata/conf.d/vnodes)
3936
3937 install(FILES
3938 system/.install-type
3939 COMPONENT netdata
3940 DESTINATION etc/netdata)
3941
3942 install(PROGRAMS
3943 system/edit-config
3944 COMPONENT netdata
3945 DESTINATION etc/netdata)
3946
3947 if(BUILD_FOR_PACKAGING)
3948 set(NETDATA_CONF_DEST "etc/netdata")
3949 else()
3950 set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d")
3951 endif()
3952
3953 #
3954 # misc files
3955 #
3956 if(BUILD_FOR_PACKAGING)
3957 install(FILES
3958 ${PKG_FILES_PATH}/deb/netdata/etc/default/netdata
3959 COMPONENT netdata
3960 DESTINATION etc/default)
3961
3962 install(PROGRAMS
3963 ${PKG_FILES_PATH}/deb/netdata/etc/init.d/netdata
3964 COMPONENT netdata
3965 DESTINATION etc/init.d)
3966 endif()
3967
3968 if(NOT OS_WINDOWS)
3969 install(PROGRAMS
3970 packaging/installer/netdata-updater.sh
3971 COMPONENT netdata
3972 DESTINATION usr/libexec/netdata)
3973
3974 install(FILES
3975 system/netdata.conf
3976 system/netdata-updater.conf
3977 COMPONENT netdata
3978 DESTINATION ${NETDATA_CONF_DEST})
3979
3980 configure_file(system/cron/netdata-updater-daily.in
3981 system/cron/netdata-updater-daily
3982 @ONLY)
3983 install(FILES
3984 ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily
3985 COMPONENT netdata
3986 DESTINATION usr/lib/netdata/system/cron)
3987
3988 configure_file(system/systemd/netdata-updater.service.in
3989 system/systemd/netdata-updater.service
3990 @ONLY)
3991 install(FILES
3992 ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
3993 COMPONENT netdata
3994 DESTINATION usr/lib/netdata/system/systemd)
3995
3996 install(FILES
3997 system/systemd/netdata-updater.timer
3998 COMPONENT netdata
3999 DESTINATION usr/lib/netdata/system/systemd)
4000
4001 if(BUILD_FOR_PACKAGING)
4002 install(FILES
4003 ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
4004 COMPONENT netdata
4005 DESTINATION lib/systemd/system)
4006 install(FILES
4007 system/systemd/netdata-updater.timer
4008 COMPONENT netdata
4009 DESTINATION lib/systemd/system)
4010 endif()
4011 endif()
4012
4013 #
4014 # TODO: check the following files for correct substitutions
4015 #
4016 configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY)
4017 install(PROGRAMS
4018 ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh
4019 COMPONENT netdata
4020 DESTINATION usr/libexec/netdata/plugins.d)
4021
4022 configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY)
4023 install(PROGRAMS
4024 ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh
4025 COMPONENT netdata
4026 DESTINATION usr/libexec/netdata/plugins.d)
4027
4028 install(PROGRAMS
4029 src/daemon/system-info.sh
4030 COMPONENT netdata
4031 DESTINATION usr/libexec/netdata/plugins.d)
4032
4033 #
4034 # health files
4035 #
4036
4037 file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf")
4038 install(FILES
4039 ${HEALTH_CONF_FILES}
4040 COMPONENT netdata
4041 DESTINATION usr/lib/netdata/conf.d/health.d)
4042
4043 configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY)
4044 install(PROGRAMS
4045 ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh
4046 COMPONENT netdata
4047 DESTINATION usr/libexec/netdata/plugins.d)
4048
4049 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
4050 install(PROGRAMS
4051 src/health/notifications/alarm-email.sh
4052 src/health/notifications/alarm-test.sh
4053 COMPONENT netdata
4054 DESTINATION usr/libexec/netdata/plugins.d)
4055 endif()
4056
4057 install(FILES
4058 src/health/notifications/health_alarm_notify.conf
4059 src/health/notifications/health_email_recipients.conf
4060 COMPONENT netdata
4061 DESTINATION usr/lib/netdata/conf.d)
4062 #
4063 # test/ files
4064 #
4065
4066 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
4067 configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY)
4068 configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY)
4069 configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY)
4070 configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY)
4071 configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY)
4072 configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY)
4073
4074 install(FILES
4075 ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh
4076 ${CMAKE_BINARY_DIR}/tests/acls/acl.sh
4077 ${CMAKE_BINARY_DIR}/tests/urls/request.sh
4078 ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh
4079 ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh
4080 ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh
4081 DESTINATION usr/libexec/netdata/plugins.d)
4082 endif()
4083
4084 #
4085 # charts.d plugin
4086 #
4087
4088 if(ENABLE_PLUGIN_CHARTS)
4089 install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d)
4090
4091 configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY)
4092 install(PROGRAMS
4093 ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin
4094 COMPONENT plugin-chartsd
4095 DESTINATION usr/libexec/netdata/plugins.d)
4096
4097 install(PROGRAMS
4098 src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
4099 COMPONENT plugin-chartsd
4100 DESTINATION usr/libexec/netdata/plugins.d)
4101
4102 install(FILES
4103 src/collectors/charts.d.plugin/charts.d.conf
4104 COMPONENT plugin-chartsd
4105 DESTINATION usr/lib/netdata/conf.d)
4106
4107 install(PROGRAMS
4108 src/collectors/charts.d.plugin/example/example.chart.sh
4109 src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
4110 src/collectors/charts.d.plugin/opensips/opensips.chart.sh
4111 COMPONENT plugin-chartsd
4112 DESTINATION usr/libexec/netdata/charts.d)
4113
4114 install(FILES
4115 src/collectors/charts.d.plugin/example/example.conf
4116 src/collectors/charts.d.plugin/libreswan/libreswan.conf
4117 src/collectors/charts.d.plugin/opensips/opensips.conf
4118 COMPONENT plugin-chartsd
4119 DESTINATION usr/lib/netdata/conf.d/charts.d)
4120
4121 if(BUILD_FOR_PACKAGING)
4122 install(FILES
4123 ${PKG_FILES_PATH}/copyright
4124 COMPONENT plugin-chartsd
4125 DESTINATION usr/share/doc/netdata-plugin-chartsd)
4126 endif()
4127 endif()
4128
4129 # This is needed both by the TC plugin (which only gets built on Linux) and the charts plugin.
4130 if(OS_LINUX OR ENABLE_PLUGIN_CHARTS)
4131 install(FILES
4132 src/collectors/charts.d.plugin/loopsleepms.sh.inc
4133 COMPONENT netdata
4134 DESTINATION usr/libexec/netdata/plugins.d)
4135 endif()
4136
4137 #
4138 # tc-qos-helper
4139 #
4140
4141 if(OS_LINUX)
4142 configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY)
4143 install(PROGRAMS
4144 ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh
4145 COMPONENT netdata
4146 DESTINATION usr/libexec/netdata/plugins.d)
4147 endif()
4148
4149 # confs
4150 install(FILES
4151 src/collectors/systemd-journal.plugin/schema.d/systemd-journal%3Amonitored-directories.json
4152 src/health/schema.d/health%3Aalert%3Aprototype.json
4153 COMPONENT netdata
4154 DESTINATION usr/lib/netdata/conf.d/schema.d)
4155
4156 #
4157 # python.d plugin
4158 #
4159
4160 if(ENABLE_PLUGIN_PYTHON)
4161 install(DIRECTORY COMPONENT plugin-pythond DESTINATION etc/netdata/python.d)
4162
4163 configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY)
4164 install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin
4165 COMPONENT plugin-pythond
4166 DESTINATION usr/libexec/netdata/plugins.d)
4167
4168 install(DIRECTORY src/collectors/python.d.plugin/python_modules
4169 COMPONENT plugin-pythond
4170 DESTINATION usr/libexec/netdata/python.d)
4171
4172 if(OS_WINDOWS)
4173 include(NetdataUtil)
4174 precompile_python(usr/libexec/netdata/python.d plugin-pythond)
4175 endif()
4176
4177 install(FILES src/collectors/python.d.plugin/python.d.conf
4178 COMPONENT plugin-pythond
4179 DESTINATION usr/lib/netdata/conf.d)
4180
4181 install(FILES
4182 src/collectors/python.d.plugin/am2320/am2320.conf
4183 src/collectors/python.d.plugin/go_expvar/go_expvar.conf
4184 src/collectors/python.d.plugin/haproxy/haproxy.conf
4185 src/collectors/python.d.plugin/pandas/pandas.conf
4186 src/collectors/python.d.plugin/traefik/traefik.conf
4187 COMPONENT plugin-pythond
4188 DESTINATION usr/lib/netdata/conf.d/python.d)
4189
4190 install(FILES
4191 src/collectors/python.d.plugin/am2320/am2320.chart.py
4192 src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
4193 src/collectors/python.d.plugin/haproxy/haproxy.chart.py
4194 src/collectors/python.d.plugin/pandas/pandas.chart.py
4195 src/collectors/python.d.plugin/traefik/traefik.chart.py
4196 COMPONENT plugin-pythond
4197 DESTINATION usr/libexec/netdata/python.d)
4198
4199 if(BUILD_FOR_PACKAGING)
4200 install(FILES
4201 ${PKG_FILES_PATH}/copyright
4202 COMPONENT plugin-pythond
4203 DESTINATION usr/share/doc/netdata-plugin-pythond)
4204 endif()
4205 endif()
4206
4207 #
4208 # ioping.plugin
4209 #
4210
4211 configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY)
4212 install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin
4213 COMPONENT netdata
4214 DESTINATION usr/libexec/netdata/plugins.d)
4215
4216 #
4217 # go.d.plugin
4218 #
4219 if(ENABLE_PLUGIN_GO)
4220 install(DIRECTORY COMPONENT plugin-go DESTINATION etc/netdata/go.d)
4221
4222 install(FILES src/go/plugin/go.d/config/go.d.conf
4223 COMPONENT plugin-go
4224 DESTINATION usr/lib/netdata/conf.d)
4225
4226 install(DIRECTORY
4227 COMPONENT plugin-go
4228 DESTINATION usr/lib/netdata/conf.d/go.d)
4229 file(GLOB GO_CONF_FILES src/go/plugin/go.d/config/go.d/*.conf)
4230 install(FILES ${GO_CONF_FILES}
4231 COMPONENT plugin-go
4232 DESTINATION usr/lib/netdata/conf.d/go.d)
4233
4234 install(DIRECTORY
4235 COMPONENT plugin-go
4236 DESTINATION usr/lib/netdata/conf.d/go.d/sd)
4237 file(GLOB GO_SD_CONF_FILES src/go/plugin/go.d/config/go.d/sd/*.conf)
4238 install(FILES ${GO_SD_CONF_FILES}
4239 COMPONENT plugin-go
4240 DESTINATION usr/lib/netdata/conf.d/go.d/sd)
4241
4242 install(DIRECTORY
4243 COMPONENT plugin-go
4244 DESTINATION usr/lib/netdata/conf.d/go.d/ss)
4245 file(GLOB GO_SS_CONF_FILES src/go/plugin/go.d/config/go.d/ss/*.conf)
4246 install(FILES ${GO_SS_CONF_FILES}
4247 COMPONENT plugin-go
4248 DESTINATION usr/lib/netdata/conf.d/go.d/ss)
4249
4250 install(DIRECTORY
4251 COMPONENT plugin-go
4252 DESTINATION usr/lib/netdata/conf.d/go.d/snmp.profiles)
4253 install(DIRECTORY
4254 COMPONENT plugin-go
4255 DESTINATION usr/lib/netdata/conf.d/go.d/snmp.profiles/default)
4256 install(DIRECTORY
4257 COMPONENT plugin-go
4258 DESTINATION usr/lib/netdata/conf.d/go.d/snmp.profiles/metadata)
4259
4260 file(GLOB GO_SNMP_PROFILE_FILES src/go/plugin/go.d/config/go.d/snmp.profiles/default/*.yaml)
4261 install(FILES ${GO_SNMP_PROFILE_FILES}
4262 COMPONENT plugin-go
4263 DESTINATION usr/lib/netdata/conf.d/go.d/snmp.profiles/default)
4264 file(GLOB GO_SNMP_META_FILES src/go/plugin/go.d/config/go.d/snmp.profiles/metadata/*.yaml)
4265 install(FILES ${GO_SNMP_META_FILES}
4266 COMPONENT plugin-go
4267 DESTINATION usr/lib/netdata/conf.d/go.d/snmp.profiles/metadata)
4268
4269 install(DIRECTORY
4270 COMPONENT plugin-go
4271 DESTINATION usr/lib/netdata/conf.d/go.d/azure_monitor.profiles)
4272 install(DIRECTORY
4273 COMPONENT plugin-go
4274 DESTINATION usr/lib/netdata/conf.d/go.d/azure_monitor.profiles/default)
4275 file(GLOB GO_AZURE_MON_PROFILE_FILES src/go/plugin/go.d/config/go.d/azure_monitor.profiles/default/*.yaml)
4276 install(FILES ${GO_AZURE_MON_PROFILE_FILES}
4277 COMPONENT plugin-go
4278 DESTINATION usr/lib/netdata/conf.d/go.d/azure_monitor.profiles/default)
4279
4280 if(BUILD_FOR_PACKAGING)
4281 install(FILES
4282 ${PKG_FILES_PATH}/copyright
4283 COMPONENT plugin-go
4284 DESTINATION usr/share/doc/netdata-plugin-go)
4285 endif()
4286 endif()
4287
4288 #
4289 # dashboard
4290 #
4291
4292 if(ENABLE_DASHBOARD)
4293 include(NetdataDashboard)
4294 bundle_dashboard()
4295
4296 install(FILES
4297 COMPONENT dashboard
4298 DESTINATION ${WEB_DEST})
4299
4300 endif()
4301
4302 #
4303 # Ship CMakeCache.txt as an archive
4304 #
4305
4306 install(CODE "
4307 execute_process(COMMAND gzip -nc \"${CMAKE_BINARY_DIR}/CMakeCache.txt\"
4308 OUTPUT_FILE \"${BUILD_INFO_CMAKE_CACHE_ARCHIVE_NAME}\"
4309 WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\"
4310 RESULT_VARIABLE result)
4311 if(NOT result EQUAL 0)
4312 message(WARNING \"Failed to compress CMakeCache.txt\")
4313 endif()
4314
4315 file(INSTALL \"${CMAKE_BINARY_DIR}/${BUILD_INFO_CMAKE_CACHE_ARCHIVE_NAME}\"
4316 DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${BUILD_INFO_CMAKE_CACHE_ARCHIVE_PATH}\")
4317 ")
4318
4319 #
4320 # vendor msys stuff on Windows
4321 #
4322
4323 if(OS_WINDOWS)
4324 install(FILES /usr/bin/msys-protobuf-32.dll
4325 /usr/bin/msys-yaml-0-2.dll
4326 /usr/bin/msys-uv-1.dll
4327 DESTINATION "${BINDIR}")
4328
4329 # Make bash & netdata happy
4330 install(DIRECTORY DESTINATION tmp)
4331
4332 # Make curl work with ssl
4333 install(DIRECTORY /usr/ssl DESTINATION usr)
4334 endif()
4335
4336 #
4337 # Optional: render integration docs from metadata.yaml
4338 #
4339
4340 include(NetdataRenderDocs)
4341
4342 #
4343 # Include packaging logic
4344 #
4345
4346 include(Packaging)