CMakeLists.txt 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085
  1. # SPDX-License-Identifier: GPL-3.0-or-later
  2. cmake_minimum_required(VERSION 3.16.0...3.30)
  3. list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/Modules")
  4. include(NetdataVersion)
  5. netdata_version()
  6. project(netdata
  7. VERSION "${NETDATA_VERSION_MAJOR}.${NETDATA_VERSION_MINOR}.${NETDATA_VERSION_PATCH}.${NETDATA_VERSION_TWEAK}"
  8. HOMEPAGE_URL "https://www.netdata.cloud"
  9. LANGUAGES C CXX)
  10. include(CMakeDependentOption)
  11. if(DEFINED BUILD_SHARED_LIBS)
  12. if(NOT BUILD_SHARED_LIBS)
  13. set(STATIC_BUILD TRUE)
  14. endif()
  15. endif()
  16. if(STATIC_BUILD)
  17. set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX}")
  18. set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
  19. endif()
  20. find_package(PkgConfig REQUIRED)
  21. if(STATIC_BUILD)
  22. list(APPEND PKG_CONFIG_EXECUTABLE "--static")
  23. endif()
  24. set(CMAKE_C_STANDARD 11)
  25. set(CMAKE_CXX_STANDARD 14)
  26. set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata")
  27. option(USE_CXX_11 "Use C++11 instead of C++14 (should only be used on legacy systems that cannot support C++14, may disable some features)" False)
  28. mark_as_advanced(USE_CXX_11)
  29. if(USE_CXX_11)
  30. set(CMAKE_CXX_STANDARD 11)
  31. endif()
  32. set(CMAKE_C_STANDARD_REQUIRED On)
  33. set(CMAKE_CXX_STANDARD_REQUIRED On)
  34. set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
  35. if(NOT CMAKE_BUILD_TYPE)
  36. set(CMAKE_BUILD_TYPE "Release")
  37. endif()
  38. include(NetdataCompilerFlags)
  39. set(CMAKE_EXPORT_COMPILE_COMMANDS On)
  40. # Check for the mold linker and try to use it if available
  41. option(USE_MOLD "If the MOLD linker is available on the system, use it instead of the default linker." TRUE)
  42. if(USE_MOLD)
  43. message(CHECK_START "Searching for MOLD linker")
  44. find_program(MOLD_LINKER NAMES ld.mold mold)
  45. if(MOLD_LINKER)
  46. execute_process(COMMAND ${MOLD_LINKER} --version
  47. RESULT_VARIABLE MOLD_VERSION_RESULT
  48. OUTPUT_VARIABLE MOLD_VERSION)
  49. if(NOT MOLD_VERSION_RESULT)
  50. string(REPLACE "\n" "" MOLD_VERSION "${MOLD_VERSION}")
  51. message(CHECK_PASS "found (version: ${MOLD_VERSION})")
  52. message(STATUS "Using mold instead of the system default for linking.")
  53. add_link_options("-fuse-ld=mold")
  54. else()
  55. message(CHECK_FAIL "failed")
  56. endif()
  57. else()
  58. message(CHECK_FAIL "failed")
  59. endif()
  60. endif()
  61. set(CONFIG_H_DIR ${CMAKE_BINARY_DIR})
  62. set(CONFIG_H ${CONFIG_H_DIR}/config.h)
  63. #
  64. # detect OS
  65. #
  66. set(OS_FREEBSD False)
  67. set(OS_LINUX False)
  68. set(OS_MACOS False)
  69. set(OS_WINDOWS False)
  70. set(NETDATA_RUNTIME_PREFIX "${CMAKE_INSTALL_PREFIX}")
  71. set(BINDIR usr/sbin)
  72. if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
  73. set(OS_MACOS True)
  74. find_library(IOKIT IOKit)
  75. find_library(FOUNDATION Foundation)
  76. message(STATUS " Compiling for MacOS... ")
  77. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
  78. set(OS_FREEBSD True)
  79. message(STATUS " Compiling for FreeBSD... ")
  80. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
  81. set(OS_LINUX True)
  82. add_definitions(-D_GNU_SOURCE)
  83. message(STATUS " Compiling for Linux... ")
  84. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  85. set(OS_WINDOWS True)
  86. if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/opt/netdata")
  87. message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be set to /opt/netdata, but it is set to ${CMAKE_INSTALL_PREFIX}")
  88. endif()
  89. if(BUILD_FOR_PACKAGING)
  90. set(NETDATA_RUNTIME_PREFIX "/")
  91. endif()
  92. set(BINDIR usr/bin)
  93. set(CMAKE_RC_COMPILER_INIT windres)
  94. ENABLE_LANGUAGE(RC)
  95. SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
  96. add_definitions(-D_GNU_SOURCE)
  97. if($ENV{CLION_IDE})
  98. # clion needs these to find the includes
  99. if("${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  100. if("$ENV{MSYSTEM}" STREQUAL "MSYS")
  101. include_directories(c:/msys64/usr/include)
  102. include_directories(c:/msys64/usr/include/w32api)
  103. elseif("$ENV{MSYSTEM}" STREQUAL "MINGW64")
  104. include_directories(c:/msys64/mingw64/include)
  105. elseif("$ENV{MSYSTEM}" STREQUAL "UCRT64")
  106. include_directories(c:/msys64/ucrt64/include)
  107. endif()
  108. endif()
  109. endif()
  110. message(STATUS " Compiling for Windows (${CMAKE_SYSTEM_NAME}, MSYSTEM=$ENV{MSYSTEM})... ")
  111. else()
  112. message(FATAL_ERROR "Unknown/unsupported platform: ${CMAKE_SYSTEM_NAME} (Supported platforms: FreeBSD, Linux, macOS, Windows)")
  113. endif()
  114. # This is intended to make life easier for developers who are working on one
  115. # specific feature.
  116. #
  117. # NOTE: DO NOT USE THIS OPTION FOR PRODUCTION BUILDS.
  118. option(DEFAULT_FEATURE_STATE "Specify the default state for most optional features" True)
  119. mark_as_advanced(DEFAULT_FEATURE_STATE)
  120. # High-level features
  121. option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE})
  122. option(ENABLE_DBENGINE "Enable dbengine metrics storage" True)
  123. # Data collection plugins
  124. option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE})
  125. option(ENABLE_PLUGIN_PYTHON "Enable metric collectors written in Python" ${DEFAULT_FEATURE_STATE})
  126. cmake_dependent_option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
  127. cmake_dependent_option(ENABLE_PLUGIN_CHARTS "Enable metric collectors written in Bash" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
  128. cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
  129. cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False)
  130. cmake_dependent_option(ENABLE_PLUGIN_CGROUP_NETWORK "Enable Linux CGroup network usage monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  131. cmake_dependent_option(ENABLE_PLUGIN_DEBUGFS "Enable Linux DebugFS metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  132. cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  133. cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False)
  134. mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS)
  135. cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  136. cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  137. cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  138. cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  139. cmake_dependent_option(ENABLE_PLUGIN_SLABINFO "Enable Linux kernel SLAB allocator monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  140. cmake_dependent_option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "Enable systemd journal log collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  141. cmake_dependent_option(ENABLE_PLUGIN_XENSTAT "Enable Xen domain monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  142. # Metrics exporters
  143. option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "Enable exporting to Prometheus via remote write API" ${DEFAULT_FEATURE_STATE})
  144. option(ENABLE_EXPORTER_MONGODB "Enable exporting to MongoDB" ${DEFAULT_FEATURE_STATE})
  145. # Vendoring
  146. option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False)
  147. option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False)
  148. option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False)
  149. # Experimental features
  150. option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False)
  151. mark_as_advanced(ENABLE_WEBRTC)
  152. option(ENABLE_H2O "Enable H2O web server (experimental)" True)
  153. mark_as_advanced(ENABLE_H2O)
  154. # Other optional functionality
  155. option(ENABLE_SENTRY "Build with Sentry Native crash reporting" False)
  156. mark_as_advanced(ENABLE_SENTRY)
  157. option(BUILD_FOR_PACKAGING "Include component files for native packages" False)
  158. mark_as_advanced(BUILD_FOR_PACKAGING)
  159. cmake_dependent_option(FORCE_LEGACY_LIBBPF "Force usage of libbpf 0.0.9 instead of the latest version." False "ENABLE_PLUGIN_EBPF" False)
  160. mark_as_advanced(FORCE_LEGACY_LIBBPF)
  161. set(NEED_PROTOBUF True)
  162. if(ENABLE_PLUGIN_GO)
  163. include(NetdataGoTools)
  164. find_min_go_version("${CMAKE_SOURCE_DIR}/src/go")
  165. find_package(Go "${MIN_GO_VERSION}" REQUIRED)
  166. endif()
  167. if(ENABLE_PLUGIN_GO)
  168. set(NEED_NDSUDO TRUE)
  169. else()
  170. set(NEED_NDSUDO FALSE)
  171. endif()
  172. if(ENABLE_WEBRTC)
  173. include(FetchContent)
  174. include(NetdataFetchContentExtra)
  175. # ignore debhelper
  176. set(FETCHCONTENT_FULLY_DISCONNECTED Off)
  177. set(PREFER_SYSTEM_LIB True)
  178. set(NO_MEDIA True)
  179. set(NO_WEBSOCKET True)
  180. set(HAVE_LIBDATACHANNEL True)
  181. FetchContent_Declare(libdatachannel
  182. GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
  183. GIT_TAG v0.20.1
  184. CMAKE_ARGS ${NETDATA_PROPAGATE_TOOLCHAIN_ARGS}
  185. )
  186. FetchContent_MakeAvailable(libdatachannel)
  187. endif()
  188. if(NEED_PROTOBUF)
  189. include(NetdataProtobuf)
  190. if(ENABLE_BUNDLED_PROTOBUF)
  191. netdata_bundle_protobuf()
  192. endif()
  193. endif()
  194. set(PKG_FILES_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/pkg-files")
  195. if(ENABLE_PLUGIN_EBPF)
  196. include(NetdataLibBPF)
  197. include(NetdataEBPFCORE)
  198. if(NOT OS_LINUX)
  199. message(FATAL_ERROR "The eBPF plugin is not supported on non-Linux systems")
  200. endif()
  201. netdata_bundle_libbpf()
  202. netdata_fetch_ebpf_co_re()
  203. endif()
  204. pkg_check_modules(CURL libcurl>=7.21 REQUIRED IMPORTED_TARGET)
  205. set(HAVE_LIBCURL TRUE)
  206. #
  207. # Libm
  208. #
  209. # checks link with cmake required libs
  210. cmake_policy(SET CMP0075 NEW)
  211. include(CheckFunctionExists)
  212. check_function_exists(log10 HAVE_LOG10)
  213. if(NOT HAVE_LOG10)
  214. unset(HAVE_LOG10 CACHE)
  215. list(APPEND CMAKE_REQUIRED_LIBRARIES m)
  216. check_function_exists(log10 HAVE_LOG10)
  217. if(HAVE_LOG10)
  218. set(LINK_LIBM True)
  219. else()
  220. message(FATAL_ERROR "Can not use log10 with/without libm.")
  221. endif()
  222. endif()
  223. #
  224. # Custom Modules
  225. #
  226. include(NetdataJSONC)
  227. include(NetdataYAML)
  228. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  229. include(NetdataEBPFLegacy)
  230. endif()
  231. if(ENABLE_SENTRY)
  232. include(NetdataSentry)
  233. endif()
  234. #
  235. # Checks from custom modules
  236. #
  237. netdata_detect_jsonc()
  238. netdata_detect_libyaml()
  239. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  240. netdata_fetch_legacy_ebpf_code()
  241. endif()
  242. if(ENABLE_SENTRY)
  243. netdata_bundle_sentry()
  244. endif()
  245. #
  246. # check include files
  247. #
  248. include(CheckIncludeFile)
  249. check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
  250. check_include_file("resolv.h" HAVE_RESOLV_H)
  251. check_include_file("netdb.h" HAVE_NETDB_H)
  252. check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
  253. check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
  254. check_include_file("sys/vfs.h" HAVE_SYS_VFS_H)
  255. check_include_file("sys/statfs.h" HAVE_SYS_STATFS_H)
  256. check_include_file("linux/magic.h" HAVE_LINUX_MAGIC_H)
  257. check_include_file("sys/mount.h" HAVE_SYS_MOUNT_H)
  258. check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H)
  259. check_include_file("inttypes.h" HAVE_INTTYPES_H)
  260. check_include_file("stdint.h" HAVE_STDINT_H)
  261. check_include_file("sys/capability.h" HAVE_SYS_CAPABILITY_H)
  262. check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
  263. check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H)
  264. check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
  265. check_include_file("grp.h" HAVE_GRP_H)
  266. check_include_file("pwd.h" HAVE_PWD_H)
  267. check_include_file("net/if.h" HAVE_NET_IF_H)
  268. check_include_file("poll.h" HAVE_POLL_H)
  269. check_include_file("syslog.h" HAVE_SYSLOG_H)
  270. check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
  271. check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
  272. check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
  273. check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
  274. check_include_file("sys/un.h" HAVE_SYS_UN_H)
  275. check_include_file("spawn.h" HAVE_SPAWN_H)
  276. #
  277. # check symbols
  278. #
  279. include(CheckSymbolExists)
  280. check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
  281. check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
  282. check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
  283. check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
  284. check_symbol_exists(finite "math.h" HAVE_FINITE)
  285. check_symbol_exists(isfinite "math.h" HAVE_ISFINITE)
  286. check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM)
  287. check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP)
  288. check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
  289. check_function_exists(gettid HAVE_GETTID)
  290. check_function_exists(waitid HAVE_WAITID)
  291. check_function_exists(nice HAVE_NICE)
  292. check_function_exists(recvmmsg HAVE_RECVMMSG)
  293. check_function_exists(getpriority HAVE_GETPRIORITY)
  294. check_function_exists(setenv HAVE_SETENV)
  295. check_function_exists(strndup HAVE_STRNDUP)
  296. check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER)
  297. check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER)
  298. check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
  299. check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
  300. check_function_exists(close_range HAVE_CLOSE_RANGE)
  301. check_function_exists(backtrace HAVE_BACKTRACE)
  302. #
  303. # check source compilation
  304. #
  305. include(CheckCSourceCompiles)
  306. include(CheckCXXSourceCompiles)
  307. set(CMAKE_REQUIRED_LIBRARIES pthread)
  308. check_c_source_compiles("
  309. #define _GNU_SOURCE
  310. #include <pthread.h>
  311. int main() {
  312. char name[16];
  313. pthread_t thread = pthread_self();
  314. return pthread_getname_np(thread, name, sizeof(name));
  315. }
  316. " HAVE_PTHREAD_GETNAME_NP)
  317. check_c_source_compiles("
  318. #include <stdio.h>
  319. #define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u')
  320. int main() {
  321. char type = mytype(0);
  322. return 0;
  323. }
  324. " HAVE_C__GENERIC)
  325. check_c_source_compiles("
  326. #include <malloc.h>
  327. int main() {
  328. mallopt(M_ARENA_MAX, 1);
  329. mallopt(M_PERTURB, 0x5A);
  330. return 0;
  331. }
  332. " HAVE_C_MALLOPT)
  333. check_c_source_compiles("
  334. #define _GNU_SOURCE
  335. #include <stdio.h>
  336. #include <sys/socket.h>
  337. int main() {
  338. accept4(0, NULL, NULL, 0);
  339. return 0;
  340. }
  341. " HAVE_ACCEPT4)
  342. check_c_source_compiles("
  343. #define _GNU_SOURCE
  344. #include <string.h>
  345. int main() {
  346. char x = *strerror_r(0, &x, sizeof(x)); return 0;
  347. }
  348. " STRERROR_R_CHAR_P)
  349. check_c_source_compiles("
  350. #ifndef _GNU_SOURCE
  351. #define _GNU_SOURCE
  352. #endif
  353. #include <sched.h>
  354. int main() {
  355. setns(0, 0); return 0;
  356. }
  357. " HAVE_SETNS)
  358. check_cxx_source_compiles("
  359. int main() {
  360. __atomic_load_8(nullptr, 0);
  361. return 0;
  362. }
  363. " HAVE_BUILTIN_ATOMICS)
  364. check_c_source_compiles("
  365. void my_printf(char const *s, ...) __attribute__((format(gnu_printf, 1, 2)));
  366. int main() { return 0; }
  367. " HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF FAIL_REGEX "warning:")
  368. check_c_source_compiles("
  369. void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
  370. int main() { return 0; }
  371. " HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF FAIL_REGEX "warning:")
  372. check_c_source_compiles("
  373. #include <stdio.h>
  374. #include <stdlib.h>
  375. #include <unistd.h>
  376. void* my_alloc(size_t size) __attribute__((malloc));
  377. int main() {
  378. void *x = my_alloc(1);
  379. free(x);
  380. return 0;
  381. }
  382. void* my_alloc(size_t size) {
  383. void *ret = malloc(size);
  384. if(!ret) exit(1);
  385. return ret;
  386. }
  387. " HAVE_FUNC_ATTRIBUTE_MALLOC)
  388. check_c_source_compiles("
  389. void my_function() __attribute__((noinline));
  390. int main() { my_function(); return 0; }
  391. void my_function() { ; }
  392. " HAVE_FUNC_ATTRIBUTE_NOINLINE)
  393. check_c_source_compiles("
  394. void my_exit_function() __attribute__((noreturn));
  395. int main() {
  396. my_exit_function(); // Call the noreturn function
  397. return 0;
  398. }
  399. void my_exit_function() {
  400. exit(1);
  401. }
  402. " HAVE_FUNC_ATTRIBUTE_NORETURN)
  403. check_c_source_compiles("
  404. #include <stdio.h>
  405. #include <stdlib.h>
  406. #include <unistd.h>
  407. void* my_alloc(size_t size) __attribute__((returns_nonnull));
  408. int main() {
  409. void* ptr = my_alloc(10);
  410. free(ptr);
  411. return 0;
  412. }
  413. void* my_alloc(size_t size) {
  414. void *ret = malloc(size);
  415. if(!ret) exit(1);
  416. return ret;
  417. }
  418. " HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL)
  419. check_c_source_compiles("
  420. int my_function() __attribute__((warn_unused_result));
  421. int main() {
  422. return my_function();
  423. }
  424. int my_function() {
  425. return 1;
  426. }
  427. " HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT)
  428. if(OS_FREEBSD OR OS_MACOS)
  429. set(HAVE_BUILTIN_ATOMICS True)
  430. endif()
  431. # openssl/crypto
  432. pkg_check_modules(TLS IMPORTED_TARGET openssl)
  433. if(NOT TARGET PkgConfig::TLS)
  434. if(OS_MACOS)
  435. execute_process(COMMAND
  436. brew --prefix --installed openssl
  437. RESULT_VARIABLE BREW_OPENSSL
  438. OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
  439. OUTPUT_STRIP_TRAILING_WHITESPACE)
  440. if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
  441. message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
  442. endif()
  443. add_library(PkgConfig::CRYPTO IMPORTED)
  444. set_target_properties(PkgConfig::CRYPTO
  445. IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libcrypto.dylib
  446. INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
  447. add_library(PkgConfig::TLS IMPORTED)
  448. set_target_properties(PkgConfig::TLS
  449. IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libssl.dylib
  450. INTERFACE_LINK_LIBRARIES PkgConfig::CRYPTO
  451. INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
  452. else()
  453. message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
  454. endif()
  455. else()
  456. pkg_check_modules(CRYPTO IMPORTED_TARGET REQUIRED libcrypto)
  457. endif()
  458. #
  459. # figure out if we need protoc/protobuf
  460. #
  461. if(NEED_PROTOBUF)
  462. netdata_detect_protobuf()
  463. endif()
  464. #
  465. # source files
  466. #
  467. set(LIBJUDY_PREV_FILES
  468. src/libnetdata/libjudy/src/JudyL/JudyLPrev.c
  469. src/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c
  470. )
  471. set(LIBJUDY_NEXT_FILES
  472. src/libnetdata/libjudy/src/JudyL/JudyLNext.c
  473. src/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c
  474. )
  475. set(LIBJUDY_SOURCES
  476. src/libnetdata/libjudy/src/Judy.h
  477. src/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c
  478. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h
  479. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h
  480. src/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h
  481. src/libnetdata/libjudy/src/JudyL/JudyL.h
  482. src/libnetdata/libjudy/src/JudyL/JudyLByCount.c
  483. src/libnetdata/libjudy/src/JudyL/JudyLCascade.c
  484. src/libnetdata/libjudy/src/JudyL/JudyLCount.c
  485. src/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c
  486. src/libnetdata/libjudy/src/JudyL/JudyLDecascade.c
  487. src/libnetdata/libjudy/src/JudyL/JudyLDel.c
  488. src/libnetdata/libjudy/src/JudyL/JudyLFirst.c
  489. src/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c
  490. src/libnetdata/libjudy/src/JudyL/j__udyLGet.c
  491. src/libnetdata/libjudy/src/JudyL/JudyLGet.c
  492. src/libnetdata/libjudy/src/JudyL/JudyLInsArray.c
  493. src/libnetdata/libjudy/src/JudyL/JudyLIns.c
  494. src/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c
  495. src/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c
  496. src/libnetdata/libjudy/src/JudyL/JudyLMemActive.c
  497. src/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c
  498. src/libnetdata/libjudy/src/JudyL/JudyLTables.c
  499. src/libnetdata/libjudy/src/JudyHS/JudyHS.c
  500. ${LIBJUDY_PREV_FILES}
  501. ${LIBJUDY_NEXT_FILES}
  502. )
  503. set(LIBNETDATA_FILES
  504. ${CONFIG_H}
  505. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.c
  506. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h
  507. src/libnetdata/config/appconfig.c
  508. src/libnetdata/config/appconfig.h
  509. src/libnetdata/aral/aral.c
  510. src/libnetdata/aral/aral.h
  511. src/libnetdata/avl/avl.c
  512. src/libnetdata/avl/avl.h
  513. src/libnetdata/buffer/buffer.c
  514. src/libnetdata/buffer/buffer.h
  515. src/libnetdata/ringbuffer/ringbuffer.c
  516. src/libnetdata/ringbuffer/ringbuffer.h
  517. src/libnetdata/circular_buffer/circular_buffer.c
  518. src/libnetdata/circular_buffer/circular_buffer.h
  519. src/libnetdata/clocks/clocks.c
  520. src/libnetdata/clocks/clocks.h
  521. src/libnetdata/completion/completion.c
  522. src/libnetdata/completion/completion.h
  523. src/libnetdata/datetime/iso8601.c
  524. src/libnetdata/datetime/iso8601.h
  525. src/libnetdata/datetime/rfc7231.c
  526. src/libnetdata/datetime/rfc7231.h
  527. src/libnetdata/datetime/rfc3339.c
  528. src/libnetdata/datetime/rfc3339.h
  529. src/libnetdata/dictionary/dictionary.c
  530. src/libnetdata/dictionary/dictionary.h
  531. src/libnetdata/eval/eval.c
  532. src/libnetdata/eval/eval.h
  533. src/libnetdata/facets/facets.c
  534. src/libnetdata/facets/facets.h
  535. src/libnetdata/functions_evloop/functions_evloop.c
  536. src/libnetdata/functions_evloop/functions_evloop.h
  537. src/libnetdata/gorilla/gorilla.cc
  538. src/libnetdata/gorilla/gorilla.h
  539. src/libnetdata/july/july.c
  540. src/libnetdata/july/july.h
  541. src/libnetdata/inlined.h
  542. src/libnetdata/json/json.c
  543. src/libnetdata/json/json.h
  544. src/libnetdata/json/jsmn.c
  545. src/libnetdata/json/jsmn.h
  546. src/libnetdata/libnetdata.c
  547. src/libnetdata/libnetdata.h
  548. src/libnetdata/line_splitter/line_splitter.c
  549. src/libnetdata/line_splitter/line_splitter.h
  550. src/libnetdata/libnetdata.h
  551. src/libnetdata/locks/locks.c
  552. src/libnetdata/locks/locks.h
  553. src/libnetdata/log/journal.c
  554. src/libnetdata/log/journal.h
  555. src/libnetdata/log/log.c
  556. src/libnetdata/log/log.h
  557. src/libnetdata/os/os.c
  558. src/libnetdata/os/os.h
  559. src/libnetdata/simple_hashtable.h
  560. src/libnetdata/os/byteorder.h
  561. src/libnetdata/onewayalloc/onewayalloc.c
  562. src/libnetdata/onewayalloc/onewayalloc.h
  563. src/libnetdata/procfile/procfile.c
  564. src/libnetdata/procfile/procfile.h
  565. src/libnetdata/query_progress/progress.c
  566. src/libnetdata/query_progress/progress.h
  567. src/libnetdata/required_dummies.h
  568. src/libnetdata/socket/security.c
  569. src/libnetdata/socket/security.h
  570. src/libnetdata/simple_pattern/simple_pattern.c
  571. src/libnetdata/simple_pattern/simple_pattern.h
  572. src/libnetdata/socket/socket.c
  573. src/libnetdata/socket/socket.h
  574. src/libnetdata/statistical/statistical.c
  575. src/libnetdata/statistical/statistical.h
  576. src/libnetdata/storage_number/storage_number.c
  577. src/libnetdata/storage_number/storage_number.h
  578. src/libnetdata/string/string.c
  579. src/libnetdata/string/string.h
  580. src/libnetdata/threads/threads.c
  581. src/libnetdata/threads/threads.h
  582. src/libnetdata/url/url.c
  583. src/libnetdata/url/url.h
  584. src/libnetdata/uuid/uuid.c
  585. src/libnetdata/uuid/uuid.h
  586. src/libnetdata/string/utf8.h
  587. src/libnetdata/worker_utilization/worker_utilization.c
  588. src/libnetdata/worker_utilization/worker_utilization.h
  589. src/libnetdata/http/http_access.c
  590. src/libnetdata/http/http_access.h
  591. src/libnetdata/http/http_defs.c
  592. src/libnetdata/http/http_defs.h
  593. src/libnetdata/http/content_type.c
  594. src/libnetdata/http/content_type.h
  595. src/libnetdata/config/dyncfg.c
  596. src/libnetdata/config/dyncfg.h
  597. src/libnetdata/json/json-c-parser-inline.h
  598. src/libnetdata/template-enum.h
  599. src/libnetdata/dictionary/dictionary-internals.h
  600. src/libnetdata/dictionary/dictionary-unittest.c
  601. src/libnetdata/dictionary/thread-cache.c
  602. src/libnetdata/dictionary/thread-cache.h
  603. src/libnetdata/dictionary/dictionary-traversal.c
  604. src/libnetdata/dictionary/dictionary-statistics.h
  605. src/libnetdata/dictionary/dictionary-locks.h
  606. src/libnetdata/dictionary/dictionary-refcount.h
  607. src/libnetdata/dictionary/dictionary-hashtable.h
  608. src/libnetdata/dictionary/dictionary-item.h
  609. src/libnetdata/dictionary/dictionary-callbacks.h
  610. src/libnetdata/linked-lists.h
  611. src/libnetdata/storage-point.h
  612. src/libnetdata/parsers/parsers.h
  613. src/libnetdata/parsers/duration.c
  614. src/libnetdata/bitmap64.h
  615. src/libnetdata/os/gettid.c
  616. src/libnetdata/os/gettid.h
  617. src/libnetdata/os/adjtimex.c
  618. src/libnetdata/os/adjtimex.h
  619. src/libnetdata/os/setresuid.c
  620. src/libnetdata/os/setresuid.h
  621. src/libnetdata/os/setresgid.c
  622. src/libnetdata/os/setresgid.h
  623. src/libnetdata/os/getgrouplist.c
  624. src/libnetdata/os/getgrouplist.h
  625. src/libnetdata/os/get_pid_max.c
  626. src/libnetdata/os/get_pid_max.h
  627. src/libnetdata/os/os-freebsd-wrappers.c
  628. src/libnetdata/os/os-freebsd-wrappers.h
  629. src/libnetdata/os/os-macos-wrappers.c
  630. src/libnetdata/os/os-macos-wrappers.h
  631. src/libnetdata/os/os-windows-wrappers.c
  632. src/libnetdata/os/os-windows-wrappers.h
  633. src/libnetdata/os/get_system_cpus.c
  634. src/libnetdata/os/get_system_cpus.h
  635. src/libnetdata/os/tinysleep.c
  636. src/libnetdata/os/tinysleep.h
  637. src/libnetdata/os/uuid_generate.c
  638. src/libnetdata/os/uuid_generate.h
  639. src/libnetdata/os/setenv.c
  640. src/libnetdata/os/setenv.h
  641. src/libnetdata/os/strndup.c
  642. src/libnetdata/os/strndup.h
  643. src/libnetdata/spawn_server/spawn_server_nofork.c
  644. src/libnetdata/spawn_server/spawn_server.h
  645. src/libnetdata/spawn_server/spawn_popen.c
  646. src/libnetdata/spawn_server/spawn_popen.h
  647. src/libnetdata/spawn_server/spawn_server_windows.c
  648. src/libnetdata/spawn_server/spawn_server_internals.h
  649. src/libnetdata/spawn_server/spawn_server_libuv.c
  650. src/libnetdata/spawn_server/spawn_server_posix.c
  651. src/libnetdata/spawn_server/spawn_library.c
  652. src/libnetdata/spawn_server/spawn_library.h
  653. src/libnetdata/os/close_range.c
  654. src/libnetdata/os/close_range.h
  655. src/libnetdata/os/setproctitle.c
  656. src/libnetdata/os/setproctitle.h
  657. src/libnetdata/paths/paths.c
  658. src/libnetdata/paths/paths.h
  659. src/libnetdata/json/json-c-parser-inline.c
  660. src/libnetdata/parsers/duration.h
  661. src/libnetdata/parsers/timeframe.c
  662. src/libnetdata/parsers/timeframe.h
  663. src/libnetdata/parsers/size.c
  664. src/libnetdata/parsers/size.h
  665. src/libnetdata/libjudy/judy-malloc.c
  666. src/libnetdata/libjudy/judy-malloc.h
  667. src/libnetdata/config/appconfig_internals.h
  668. src/libnetdata/config/appconfig_exporters.c
  669. src/libnetdata/config/appconfig_conf_file.c
  670. src/libnetdata/config/appconfig_cleanup.c
  671. src/libnetdata/config/appconfig_sections.c
  672. src/libnetdata/config/appconfig_options.c
  673. src/libnetdata/config/appconfig_migrate.c
  674. src/libnetdata/config/appconfig_traversal.c
  675. src/libnetdata/config/appconfig_api_sizes.c
  676. src/libnetdata/config/appconfig_api_sizes.h
  677. src/libnetdata/config/appconfig_api_durations.c
  678. src/libnetdata/config/appconfig_api_durations.h
  679. src/libnetdata/config/appconfig_api_numbers.c
  680. src/libnetdata/config/appconfig_api_numbers.h
  681. src/libnetdata/config/appconfig_api_text.c
  682. src/libnetdata/config/appconfig_api_text.h
  683. src/libnetdata/config/appconfig_api_boolean.c
  684. src/libnetdata/config/appconfig_api_boolean.h
  685. src/libnetdata/facets/logs_query_status.h
  686. src/libnetdata/os/timestamps.c
  687. src/libnetdata/os/timestamps.h
  688. )
  689. if(ENABLE_PLUGIN_EBPF)
  690. list(APPEND LIBNETDATA_FILES
  691. src/libnetdata/ebpf/ebpf.c
  692. src/libnetdata/ebpf/ebpf.h
  693. )
  694. endif()
  695. set(LIBH2O_FILES
  696. src/web/server/h2o/libh2o/deps/cloexec/cloexec.c
  697. src/web/server/h2o/libh2o/deps/libgkc/gkc.c
  698. src/web/server/h2o/libh2o/deps/libyrmcds/close.c
  699. src/web/server/h2o/libh2o/deps/libyrmcds/connect.c
  700. src/web/server/h2o/libh2o/deps/libyrmcds/recv.c
  701. src/web/server/h2o/libh2o/deps/libyrmcds/send.c
  702. src/web/server/h2o/libh2o/deps/libyrmcds/send_text.c
  703. src/web/server/h2o/libh2o/deps/libyrmcds/socket.c
  704. src/web/server/h2o/libh2o/deps/libyrmcds/strerror.c
  705. src/web/server/h2o/libh2o/deps/libyrmcds/text_mode.c
  706. src/web/server/h2o/libh2o/deps/picohttpparser/picohttpparser.c
  707. src/web/server/h2o/libh2o/lib/common/cache.c
  708. src/web/server/h2o/libh2o/lib/common/file.c
  709. src/web/server/h2o/libh2o/lib/common/filecache.c
  710. src/web/server/h2o/libh2o/lib/common/hostinfo.c
  711. src/web/server/h2o/libh2o/lib/common/http1client.c
  712. src/web/server/h2o/libh2o/lib/common/memcached.c
  713. src/web/server/h2o/libh2o/lib/common/memory.c
  714. src/web/server/h2o/libh2o/lib/common/multithread.c
  715. src/web/server/h2o/libh2o/lib/common/serverutil.c
  716. src/web/server/h2o/libh2o/lib/common/socket.c
  717. src/web/server/h2o/libh2o/lib/common/socketpool.c
  718. src/web/server/h2o/libh2o/lib/common/string.c
  719. src/web/server/h2o/libh2o/lib/common/time.c
  720. src/web/server/h2o/libh2o/lib/common/timeout.c
  721. src/web/server/h2o/libh2o/lib/common/url.c
  722. src/web/server/h2o/libh2o/lib/core/config.c
  723. src/web/server/h2o/libh2o/lib/core/configurator.c
  724. src/web/server/h2o/libh2o/lib/core/context.c
  725. src/web/server/h2o/libh2o/lib/core/headers.c
  726. src/web/server/h2o/libh2o/lib/core/logconf.c
  727. src/web/server/h2o/libh2o/lib/core/proxy.c
  728. src/web/server/h2o/libh2o/lib/core/request.c
  729. src/web/server/h2o/libh2o/lib/core/token.c
  730. src/web/server/h2o/libh2o/lib/core/util.c
  731. src/web/server/h2o/libh2o/lib/handler/access_log.c
  732. src/web/server/h2o/libh2o/lib/handler/chunked.c
  733. src/web/server/h2o/libh2o/lib/handler/compress.c
  734. src/web/server/h2o/libh2o/lib/handler/compress/gzip.c
  735. src/web/server/h2o/libh2o/lib/handler/errordoc.c
  736. src/web/server/h2o/libh2o/lib/handler/expires.c
  737. src/web/server/h2o/libh2o/lib/handler/fastcgi.c
  738. src/web/server/h2o/libh2o/lib/handler/file.c
  739. src/web/server/h2o/libh2o/lib/handler/headers.c
  740. src/web/server/h2o/libh2o/lib/handler/mimemap.c
  741. src/web/server/h2o/libh2o/lib/handler/proxy.c
  742. src/web/server/h2o/libh2o/lib/handler/redirect.c
  743. src/web/server/h2o/libh2o/lib/handler/reproxy.c
  744. src/web/server/h2o/libh2o/lib/handler/throttle_resp.c
  745. src/web/server/h2o/libh2o/lib/handler/status.c
  746. src/web/server/h2o/libh2o/lib/handler/headers_util.c
  747. src/web/server/h2o/libh2o/lib/handler/status/events.c
  748. src/web/server/h2o/libh2o/lib/handler/status/requests.c
  749. src/web/server/h2o/libh2o/lib/handler/http2_debug_state.c
  750. src/web/server/h2o/libh2o/lib/handler/status/durations.c
  751. src/web/server/h2o/libh2o/lib/handler/configurator/access_log.c
  752. src/web/server/h2o/libh2o/lib/handler/configurator/compress.c
  753. src/web/server/h2o/libh2o/lib/handler/configurator/errordoc.c
  754. src/web/server/h2o/libh2o/lib/handler/configurator/expires.c
  755. src/web/server/h2o/libh2o/lib/handler/configurator/fastcgi.c
  756. src/web/server/h2o/libh2o/lib/handler/configurator/file.c
  757. src/web/server/h2o/libh2o/lib/handler/configurator/headers.c
  758. src/web/server/h2o/libh2o/lib/handler/configurator/proxy.c
  759. src/web/server/h2o/libh2o/lib/handler/configurator/redirect.c
  760. src/web/server/h2o/libh2o/lib/handler/configurator/reproxy.c
  761. src/web/server/h2o/libh2o/lib/handler/configurator/throttle_resp.c
  762. src/web/server/h2o/libh2o/lib/handler/configurator/status.c
  763. src/web/server/h2o/libh2o/lib/handler/configurator/http2_debug_state.c
  764. src/web/server/h2o/libh2o/lib/handler/configurator/headers_util.c
  765. src/web/server/h2o/libh2o/lib/http1.c
  766. src/web/server/h2o/libh2o/lib/tunnel.c
  767. src/web/server/h2o/libh2o/lib/http2/cache_digests.c
  768. src/web/server/h2o/libh2o/lib/http2/casper.c
  769. src/web/server/h2o/libh2o/lib/http2/connection.c
  770. src/web/server/h2o/libh2o/lib/http2/frame.c
  771. src/web/server/h2o/libh2o/lib/http2/hpack.c
  772. src/web/server/h2o/libh2o/lib/http2/scheduler.c
  773. src/web/server/h2o/libh2o/lib/http2/stream.c
  774. src/web/server/h2o/libh2o/lib/http2/http2_debug_state.c
  775. )
  776. set(DAEMON_FILES
  777. src/daemon/buildinfo.c
  778. src/daemon/buildinfo.h
  779. src/daemon/common.c
  780. src/daemon/common.h
  781. src/daemon/daemon.c
  782. src/daemon/daemon.h
  783. src/daemon/libuv_workers.c
  784. src/daemon/libuv_workers.h
  785. src/daemon/global_statistics.c
  786. src/daemon/global_statistics.h
  787. src/daemon/analytics.c
  788. src/daemon/analytics.h
  789. src/daemon/main.c
  790. src/daemon/main.h
  791. src/daemon/environment.c
  792. src/daemon/win_system-info.c
  793. src/daemon/win_system-info.h
  794. src/daemon/signals.c
  795. src/daemon/signals.h
  796. src/daemon/service.c
  797. src/daemon/watcher.c
  798. src/daemon/watcher.h
  799. src/daemon/static_threads.c
  800. src/daemon/static_threads.h
  801. src/daemon/commands.c
  802. src/daemon/commands.h
  803. src/daemon/pipename.c
  804. src/daemon/pipename.h
  805. src/daemon/unit_test.c
  806. src/daemon/unit_test.h
  807. src/daemon/config/dyncfg.c
  808. src/daemon/config/dyncfg.h
  809. src/daemon/config/dyncfg-files.c
  810. src/daemon/config/dyncfg-unittest.c
  811. src/daemon/config/dyncfg-inline.c
  812. src/daemon/config/dyncfg-echo.c
  813. src/daemon/config/dyncfg-internals.h
  814. src/daemon/config/dyncfg-intercept.c
  815. src/daemon/config/dyncfg-tree.c
  816. )
  817. set(H2O_FILES
  818. src/web/server/h2o/http_server.c
  819. src/web/server/h2o/http_server.h
  820. src/web/server/h2o/h2o_utils.c
  821. src/web/server/h2o/h2o_utils.h
  822. src/web/server/h2o/streaming.c
  823. src/web/server/h2o/streaming.h
  824. src/web/server/h2o/connlist.c
  825. src/web/server/h2o/connlist.h
  826. )
  827. if(ENABLE_H2O)
  828. list(APPEND DAEMON_FILES ${H2O_FILES})
  829. endif()
  830. set(API_PLUGIN_FILES
  831. src/web/api/web_api.c
  832. src/web/api/web_api.h
  833. src/web/api/web_api_v1.c
  834. src/web/api/web_api_v1.h
  835. src/web/api/web_api_v2.c
  836. src/web/api/web_api_v2.h
  837. src/web/api/web_api_v3.c
  838. src/web/api/web_api_v3.h
  839. src/web/api/http_auth.c
  840. src/web/api/http_auth.h
  841. src/web/api/http_header.c
  842. src/web/api/http_header.h
  843. src/web/api/maps/rrdr_options.c
  844. src/web/api/maps/rrdr_options.h
  845. src/web/api/maps/contexts_options.c
  846. src/web/api/maps/contexts_options.h
  847. src/web/api/maps/datasource_formats.c
  848. src/web/api/maps/datasource_formats.h
  849. src/web/api/maps/maps.h
  850. src/web/api/maps/contexts_alert_statuses.c
  851. src/web/api/maps/contexts_alert_statuses.h
  852. src/web/api/v1/api_v1_allmetrics.c
  853. src/web/api/v1/api_v1_badge/web_buffer_svg.c
  854. src/web/api/v1/api_v1_function.c
  855. src/web/api/v1/api_v1_manage.c
  856. src/web/api/v1/api_v1_calls.h
  857. src/web/api/v1/api_v1_dbengine.c
  858. src/web/api/v1/api_v1_config.c
  859. src/web/api/v1/api_v1_functions.c
  860. src/web/api/v1/api_v1_weights.c
  861. src/web/api/v1/api_v1_info.c
  862. src/web/api/v1/api_v1_registry.c
  863. src/web/api/v1/api_v1_data.c
  864. src/web/api/v1/api_v1_contexts.c
  865. src/web/api/v1/api_v1_ml_info.c
  866. src/web/api/v1/api_v1_aclk.c
  867. src/web/api/v1/api_v1_context.c
  868. src/web/api/v1/api_v1_alarms.c
  869. src/web/api/v1/api_v1_charts.c
  870. src/web/api/v2/api_v2_info.c
  871. src/web/api/v2/api_v2_nodes.c
  872. src/web/api/v2/api_v2_node_instances.c
  873. src/web/api/v2/api_v2_q.c
  874. src/web/api/v2/api_v2_versions.c
  875. src/web/api/v2/api_v2_functions.c
  876. src/web/api/v2/api_v2_alerts.c
  877. src/web/api/v2/api_v2_alert_transitions.c
  878. src/web/api/v2/api_v2_ilove/ilove.c
  879. src/web/api/v2/api_v2_bearer.c
  880. src/web/api/v2/api_v2_calls.h
  881. src/web/api/v2/api_v2_data.c
  882. src/web/api/v2/api_v2_progress.c
  883. src/web/api/v2/api_v2_weights.c
  884. src/web/api/v2/api_v2_alert_config.c
  885. src/web/api/v2/api_v2_contexts.c
  886. src/web/api/v2/api_v2_claim.c
  887. src/web/api/v2/api_v2_webrtc.c
  888. src/web/api/v3/api_v3_calls.h
  889. src/web/api/v3/api_v3_settings.c
  890. src/web/api/functions/functions.c
  891. src/web/api/functions/functions.h
  892. src/web/api/functions/function-progress.c
  893. src/web/api/functions/function-progress.h
  894. src/web/api/functions/function-streaming.c
  895. src/web/api/functions/function-streaming.h
  896. src/web/api/queries/rrdr.c
  897. src/web/api/queries/rrdr.h
  898. src/web/api/queries/query.c
  899. src/web/api/queries/query.h
  900. src/web/api/queries/average/average.c
  901. src/web/api/queries/average/average.h
  902. src/web/api/queries/countif/countif.c
  903. src/web/api/queries/countif/countif.h
  904. src/web/api/queries/incremental_sum/incremental_sum.c
  905. src/web/api/queries/incremental_sum/incremental_sum.h
  906. src/web/api/queries/max/max.c
  907. src/web/api/queries/max/max.h
  908. src/web/api/queries/min/min.c
  909. src/web/api/queries/min/min.h
  910. src/web/api/queries/sum/sum.c
  911. src/web/api/queries/sum/sum.h
  912. src/web/api/queries/median/median.c
  913. src/web/api/queries/median/median.h
  914. src/web/api/queries/percentile/percentile.c
  915. src/web/api/queries/percentile/percentile.h
  916. src/web/api/queries/stddev/stddev.c
  917. src/web/api/queries/stddev/stddev.h
  918. src/web/api/queries/ses/ses.c
  919. src/web/api/queries/ses/ses.h
  920. src/web/api/queries/des/des.c
  921. src/web/api/queries/des/des.h
  922. src/web/api/queries/trimmed_mean/trimmed_mean.c
  923. src/web/api/queries/trimmed_mean/trimmed_mean.h
  924. src/web/api/queries/weights.c
  925. src/web/api/queries/weights.h
  926. src/web/api/formatters/rrd2json.c
  927. src/web/api/formatters/rrd2json.h
  928. src/web/api/formatters/csv/csv.c
  929. src/web/api/formatters/csv/csv.h
  930. src/web/api/formatters/json/json.c
  931. src/web/api/formatters/json/json.h
  932. src/web/api/formatters/ssv/ssv.c
  933. src/web/api/formatters/ssv/ssv.h
  934. src/web/api/formatters/value/value.c
  935. src/web/api/formatters/value/value.h
  936. src/web/api/formatters/json_wrapper.c
  937. src/web/api/formatters/json_wrapper.h
  938. src/web/api/formatters/charts2json.c
  939. src/web/api/formatters/charts2json.h
  940. src/web/api/formatters/rrdset2json.c
  941. src/web/api/formatters/rrdset2json.h
  942. src/web/rtc/webrtc.c
  943. src/web/rtc/webrtc.h
  944. src/web/api/functions/function-bearer_get_token.c
  945. src/web/api/functions/function-bearer_get_token.h
  946. src/web/api/v3/api_v3_me.c
  947. )
  948. set(EXPORTING_ENGINE_FILES
  949. src/exporting/exporting_engine.c
  950. src/exporting/exporting_engine.h
  951. src/exporting/graphite/graphite.c
  952. src/exporting/graphite/graphite.h
  953. src/exporting/json/json.c
  954. src/exporting/json/json.h
  955. src/exporting/opentsdb/opentsdb.c
  956. src/exporting/opentsdb/opentsdb.h
  957. src/exporting/prometheus/prometheus.c
  958. src/exporting/prometheus/prometheus.h
  959. src/exporting/read_config.c
  960. src/exporting/clean_connectors.c
  961. src/exporting/init_connectors.c
  962. src/exporting/process_data.c
  963. src/exporting/check_filters.c
  964. src/exporting/send_data.c
  965. src/exporting/send_internal_metrics.c
  966. )
  967. set(HEALTH_PLUGIN_FILES
  968. src/health/health.c
  969. src/health/health.h
  970. src/health/health_config.c
  971. src/health/health_json.c
  972. src/health/health_log.c
  973. src/health/health_prototypes.c
  974. src/health/health_prototypes.h
  975. src/health/health_silencers.c
  976. src/health/health_silencers.h
  977. src/health/health_internals.h
  978. src/health/health_notifications.c
  979. src/health/health_event_loop.c
  980. src/health/health_dyncfg.c
  981. src/health/health_variable.c
  982. src/health/rrdcalc.c
  983. src/health/rrdcalc.h
  984. src/health/rrdvar.c
  985. src/health/rrdvar.h
  986. )
  987. set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c)
  988. if(ENABLE_ML)
  989. set(ML_FILES
  990. src/ml/ad_charts.h
  991. src/ml/ad_charts.cc
  992. src/ml/Config.cc
  993. src/ml/dlib/dlib/all/source.cpp
  994. src/ml/ml.h
  995. src/ml/ml.cc
  996. src/ml/ml-private.h
  997. )
  998. else()
  999. set(ML_FILES
  1000. src/ml/ml.h
  1001. src/ml/ml-dummy.c
  1002. )
  1003. endif()
  1004. set(INTERNAL_COLLECTORS_FILES
  1005. src/collectors/common-contexts/common-contexts.h
  1006. src/collectors/common-contexts/disk.io.h
  1007. src/collectors/common-contexts/system.io.h
  1008. src/collectors/common-contexts/system.interrupts.h
  1009. src/collectors/common-contexts/system.processes.h
  1010. src/collectors/common-contexts/system.ram.h
  1011. src/collectors/common-contexts/mem.swap.h
  1012. src/collectors/common-contexts/mem.pgfaults.h
  1013. src/collectors/common-contexts/mem.available.h
  1014. )
  1015. set(PLUGINSD_PLUGIN_FILES
  1016. src/collectors/plugins.d/plugins_d.c
  1017. src/collectors/plugins.d/plugins_d.h
  1018. src/collectors/plugins.d/pluginsd_dyncfg.c
  1019. src/collectors/plugins.d/pluginsd_dyncfg.h
  1020. src/collectors/plugins.d/pluginsd_functions.c
  1021. src/collectors/plugins.d/pluginsd_functions.h
  1022. src/collectors/plugins.d/pluginsd_internals.c
  1023. src/collectors/plugins.d/pluginsd_internals.h
  1024. src/collectors/plugins.d/pluginsd_parser.c
  1025. src/collectors/plugins.d/pluginsd_parser.h
  1026. src/collectors/plugins.d/pluginsd_replication.c
  1027. src/collectors/plugins.d/pluginsd_replication.h
  1028. )
  1029. set(RRD_PLUGIN_FILES
  1030. src/database/contexts/api_v1_contexts.c
  1031. src/database/contexts/api_v2_contexts.c
  1032. src/database/contexts/api_v2_contexts.h
  1033. src/database/contexts/api_v2_contexts_agents.c
  1034. src/database/contexts/api_v2_contexts_alerts.c
  1035. src/database/contexts/api_v2_contexts_alerts.h
  1036. src/database/contexts/api_v2_contexts_alert_transitions.c
  1037. src/database/contexts/api_v2_contexts_alert_config.c
  1038. src/database/contexts/context.c
  1039. src/database/contexts/instance.c
  1040. src/database/contexts/internal.h
  1041. src/database/contexts/metric.c
  1042. src/database/contexts/query_scope.c
  1043. src/database/contexts/query_target.c
  1044. src/database/contexts/rrdcontext.c
  1045. src/database/contexts/rrdcontext.h
  1046. src/database/contexts/worker.c
  1047. src/database/rrdcollector.c
  1048. src/database/rrdcollector.h
  1049. src/database/rrddim.c
  1050. src/database/rrdfunctions.c
  1051. src/database/rrdfunctions.h
  1052. src/database/rrdfunctions-inline.c
  1053. src/database/rrdfunctions-inline.h
  1054. src/database/rrdhost.c
  1055. src/database/rrdlabels.c
  1056. src/database/rrd.c
  1057. src/database/rrd.h
  1058. src/database/rrdset.c
  1059. src/database/storage_engine.c
  1060. src/database/storage_engine.h
  1061. src/database/ram/rrddim_mem.c
  1062. src/database/ram/rrddim_mem.h
  1063. src/database/sqlite/sqlite_metadata.c
  1064. src/database/sqlite/sqlite_metadata.h
  1065. src/database/sqlite/sqlite_functions.c
  1066. src/database/sqlite/sqlite_functions.h
  1067. src/database/sqlite/sqlite_context.c
  1068. src/database/sqlite/sqlite_context.h
  1069. src/database/sqlite/sqlite_db_migration.c
  1070. src/database/sqlite/sqlite_db_migration.h
  1071. src/database/sqlite/sqlite_aclk.c
  1072. src/database/sqlite/sqlite_aclk.h
  1073. src/database/sqlite/sqlite_health.c
  1074. src/database/sqlite/sqlite_health.h
  1075. src/database/sqlite/sqlite_aclk_node.c
  1076. src/database/sqlite/sqlite_aclk_node.h
  1077. src/database/sqlite/sqlite_aclk_alert.c
  1078. src/database/sqlite/sqlite_aclk_alert.h
  1079. src/database/sqlite/sqlite3.c
  1080. src/database/sqlite/sqlite3.h
  1081. src/database/sqlite/sqlite3recover.c
  1082. src/database/sqlite/sqlite3recover.h
  1083. src/database/sqlite/dbdata.c
  1084. src/database/KolmogorovSmirnovDist.c
  1085. src/database/KolmogorovSmirnovDist.h
  1086. src/database/rrdfunctions-inflight.c
  1087. src/database/rrdfunctions-inflight.h
  1088. src/database/rrdfunctions-exporters.c
  1089. src/database/rrdfunctions-exporters.h
  1090. src/database/rrdfunctions-internals.h
  1091. src/database/rrdcollector-internals.h
  1092. )
  1093. if(ENABLE_DBENGINE)
  1094. list(APPEND RRD_PLUGIN_FILES
  1095. src/database/engine/rrdengine.c
  1096. src/database/engine/rrdengine.h
  1097. src/database/engine/rrddiskprotocol.h
  1098. src/database/engine/datafile.c
  1099. src/database/engine/datafile.h
  1100. src/database/engine/journalfile.c
  1101. src/database/engine/journalfile.h
  1102. src/database/engine/rrdenginelib.c
  1103. src/database/engine/rrdenginelib.h
  1104. src/database/engine/rrdengineapi.c
  1105. src/database/engine/rrdengineapi.h
  1106. src/database/engine/pagecache.c
  1107. src/database/engine/pagecache.h
  1108. src/database/engine/page_test.cc
  1109. src/database/engine/page.c
  1110. src/database/engine/page.h
  1111. src/database/engine/cache.c
  1112. src/database/engine/cache.h
  1113. src/database/engine/metric.c
  1114. src/database/engine/metric.h
  1115. src/database/engine/pdc.c
  1116. src/database/engine/pdc.h
  1117. src/database/engine/dbengine-unittest.c
  1118. src/database/engine/dbengine-stresstest.c
  1119. src/database/engine/dbengine-compression.c
  1120. src/database/engine/dbengine-compression.h
  1121. )
  1122. endif()
  1123. set(REGISTRY_PLUGIN_FILES
  1124. src/registry/registry.c
  1125. src/registry/registry.h
  1126. src/registry/registry_db.c
  1127. src/registry/registry_init.c
  1128. src/registry/registry_internals.c
  1129. src/registry/registry_internals.h
  1130. src/registry/registry_log.c
  1131. src/registry/registry_machine.c
  1132. src/registry/registry_machine.h
  1133. src/registry/registry_person.c
  1134. src/registry/registry_person.h
  1135. )
  1136. set(STATSD_PLUGIN_FILES
  1137. src/collectors/statsd.plugin/statsd.c
  1138. )
  1139. set(SYSTEMD_JOURNAL_PLUGIN_FILES
  1140. src/collectors/systemd-journal.plugin/systemd-journal.c
  1141. src/collectors/systemd-journal.plugin/systemd-internals.h
  1142. src/collectors/systemd-journal.plugin/systemd-main.c
  1143. src/collectors/systemd-journal.plugin/systemd-units.c
  1144. src/collectors/systemd-journal.plugin/systemd-journal.c
  1145. src/collectors/systemd-journal.plugin/systemd-journal-annotations.c
  1146. src/collectors/systemd-journal.plugin/systemd-journal-files.c
  1147. src/collectors/systemd-journal.plugin/systemd-journal-fstat.c
  1148. src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
  1149. src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c
  1150. src/libnetdata/maps/system-users.h
  1151. src/libnetdata/maps/system-groups.h
  1152. src/libnetdata/maps/system-services.h
  1153. src/collectors/systemd-journal.plugin/systemd-journal-sampling.h
  1154. )
  1155. set(STREAMING_PLUGIN_FILES
  1156. src/streaming/rrdpush.c
  1157. src/streaming/rrdpush.h
  1158. src/streaming/compression.c
  1159. src/streaming/compression.h
  1160. src/streaming/compression_brotli.c
  1161. src/streaming/compression_brotli.h
  1162. src/streaming/compression_gzip.c
  1163. src/streaming/compression_gzip.h
  1164. src/streaming/compression_lz4.c
  1165. src/streaming/compression_lz4.h
  1166. src/streaming/compression_zstd.c
  1167. src/streaming/compression_zstd.h
  1168. src/streaming/receiver.c
  1169. src/streaming/sender.c
  1170. src/streaming/replication.c
  1171. src/streaming/replication.h
  1172. src/streaming/common.h
  1173. src/streaming/protocol/command-nodeid.c
  1174. src/streaming/protocol/commands.c
  1175. src/streaming/protocol/commands.h
  1176. src/streaming/protocol/command-claimed_id.c
  1177. src/streaming/stream_path.c
  1178. src/streaming/stream_path.h
  1179. src/streaming/stream_capabilities.c
  1180. src/streaming/stream_capabilities.h
  1181. src/streaming/sender_connect.c
  1182. src/streaming/sender_internals.h
  1183. src/streaming/sender_execute.c
  1184. src/streaming/sender_commit.c
  1185. )
  1186. set(WEB_PLUGIN_FILES
  1187. src/web/server/web_client.c
  1188. src/web/server/web_client.h
  1189. src/web/server/web_server.c
  1190. src/web/server/web_server.h
  1191. src/web/server/static/static-threaded.c
  1192. src/web/server/static/static-threaded.h
  1193. src/web/server/web_client_cache.c
  1194. src/web/server/web_client_cache.h
  1195. )
  1196. set(CLAIM_PLUGIN_FILES
  1197. src/claim/claim.c
  1198. src/claim/claim.h
  1199. src/claim/claim_id.c
  1200. src/claim/claim_id.h
  1201. src/claim/cloud-conf.c
  1202. src/claim/claim-with-api.c
  1203. src/claim/cloud-status.c
  1204. src/claim/cloud-status.h
  1205. )
  1206. set(CLAIM_WINDOWS_FILES
  1207. src/claim/main.c
  1208. src/claim/main.h
  1209. src/claim/ui.c
  1210. src/claim/ui.h
  1211. )
  1212. set(ACLK_ALWAYS_BUILD
  1213. src/aclk/aclk_proxy.c
  1214. src/aclk/aclk_proxy.h
  1215. src/aclk/aclk.c
  1216. src/aclk/aclk.h
  1217. src/aclk/aclk_capas.c
  1218. src/aclk/aclk_capas.h
  1219. src/aclk/aclk_util.c
  1220. src/aclk/aclk_util.h
  1221. src/aclk/https_client.c
  1222. src/aclk/https_client.h
  1223. src/libnetdata/c_rhash/c_rhash.c
  1224. src/libnetdata/c_rhash/c_rhash.h
  1225. src/libnetdata/c_rhash/c_rhash_internal.h
  1226. )
  1227. set(TIMEX_PLUGIN_FILES
  1228. src/collectors/timex.plugin/plugin_timex.c
  1229. )
  1230. set(PROFILE_PLUGIN_FILES
  1231. src/collectors/profile.plugin/plugin_profile.cc
  1232. )
  1233. set(CGROUPS_PLUGIN_FILES
  1234. src/collectors/cgroups.plugin/sys_fs_cgroup.c
  1235. src/collectors/cgroups.plugin/sys_fs_cgroup.h
  1236. src/collectors/cgroups.plugin/cgroup-internals.h
  1237. src/collectors/cgroups.plugin/cgroup-discovery.c
  1238. src/collectors/cgroups.plugin/cgroup-charts.c
  1239. src/collectors/cgroups.plugin/cgroup-top.c
  1240. )
  1241. set(DISKSPACE_PLUGIN_FILES
  1242. src/collectors/diskspace.plugin/plugin_diskspace.c
  1243. )
  1244. set(MACOS_PLUGIN_FILES
  1245. src/collectors/macos.plugin/plugin_macos.c
  1246. src/collectors/macos.plugin/plugin_macos.h
  1247. src/collectors/macos.plugin/macos_sysctl.c
  1248. src/collectors/macos.plugin/macos_mach_smi.c
  1249. src/collectors/macos.plugin/macos_fw.c
  1250. )
  1251. set(FREEBSD_PLUGIN_FILES
  1252. src/collectors/freebsd.plugin/plugin_freebsd.c
  1253. src/collectors/freebsd.plugin/plugin_freebsd.h
  1254. src/collectors/freebsd.plugin/freebsd_sysctl.c
  1255. src/collectors/freebsd.plugin/freebsd_getmntinfo.c
  1256. src/collectors/freebsd.plugin/freebsd_getifaddrs.c
  1257. src/collectors/freebsd.plugin/freebsd_devstat.c
  1258. src/collectors/freebsd.plugin/freebsd_kstat_zfs.c
  1259. src/collectors/freebsd.plugin/freebsd_ipfw.c
  1260. src/collectors/proc.plugin/zfs_common.c
  1261. src/collectors/proc.plugin/zfs_common.h
  1262. )
  1263. set(WINDOWS_EVENTS_PLUGIN_FILES
  1264. src/collectors/windows-events.plugin/windows-events.c
  1265. src/collectors/windows-events.plugin/windows-events.h
  1266. src/collectors/windows-events.plugin/windows-events-query.h
  1267. src/collectors/windows-events.plugin/windows-events-query.c
  1268. src/collectors/windows-events.plugin/windows-events-sources.c
  1269. src/collectors/windows-events.plugin/windows-events-sources.h
  1270. src/collectors/windows-events.plugin/windows-events-sid.c
  1271. src/collectors/windows-events.plugin/windows-events-sid.h
  1272. src/collectors/windows-events.plugin/windows-events-unicode.c
  1273. src/collectors/windows-events.plugin/windows-events-unicode.h
  1274. src/collectors/windows-events.plugin/windows-events-xml.c
  1275. src/collectors/windows-events.plugin/windows-events-xml.h
  1276. )
  1277. set(WINDOWS_PLUGIN_FILES
  1278. src/collectors/windows.plugin/windows_plugin.c
  1279. src/collectors/windows.plugin/windows_plugin.h
  1280. src/collectors/windows.plugin/GetSystemUptime.c
  1281. src/collectors/windows.plugin/GetSystemRAM.c
  1282. src/collectors/windows.plugin/GetSystemCPU.c
  1283. src/collectors/windows.plugin/perflib.c
  1284. src/collectors/windows.plugin/perflib.h
  1285. src/collectors/windows.plugin/perflib-rrd.c
  1286. src/collectors/windows.plugin/perflib-rrd.h
  1287. src/collectors/windows.plugin/perflib-names.c
  1288. src/collectors/windows.plugin/perflib-dump.c
  1289. src/collectors/windows.plugin/perflib-storage.c
  1290. src/collectors/windows.plugin/perflib-processor.c
  1291. src/collectors/windows.plugin/perflib-thermalzone.c
  1292. src/collectors/windows.plugin/perflib-objects.c
  1293. src/collectors/windows.plugin/perflib-network.c
  1294. src/collectors/windows.plugin/perflib-memory.c
  1295. src/collectors/windows.plugin/perflib-processes.c
  1296. )
  1297. set(PROC_PLUGIN_FILES
  1298. src/collectors/proc.plugin/ipc.c
  1299. src/collectors/proc.plugin/plugin_proc.c
  1300. src/collectors/proc.plugin/plugin_proc.h
  1301. src/collectors/proc.plugin/proc_sys_fs_file_nr.c
  1302. src/collectors/proc.plugin/proc_diskstats.c
  1303. src/collectors/proc.plugin/proc_mdstat.c
  1304. src/collectors/proc.plugin/proc_interrupts.c
  1305. src/collectors/proc.plugin/proc_softirqs.c
  1306. src/collectors/proc.plugin/proc_loadavg.c
  1307. src/collectors/proc.plugin/proc_meminfo.c
  1308. src/collectors/proc.plugin/proc_pagetypeinfo.c
  1309. src/collectors/proc.plugin/proc_net_dev.c
  1310. src/collectors/proc.plugin/proc_net_dev_renames.c
  1311. src/collectors/proc.plugin/proc_net_dev_renames.h
  1312. src/collectors/proc.plugin/proc_net_wireless.c
  1313. src/collectors/proc.plugin/proc_net_ip_vs_stats.c
  1314. src/collectors/proc.plugin/proc_net_netstat.c
  1315. src/collectors/proc.plugin/proc_net_rpc_nfs.c
  1316. src/collectors/proc.plugin/proc_net_rpc_nfsd.c
  1317. src/collectors/proc.plugin/proc_net_sctp_snmp.c
  1318. src/collectors/proc.plugin/proc_net_sockstat.c
  1319. src/collectors/proc.plugin/proc_net_sockstat6.c
  1320. src/collectors/proc.plugin/proc_net_softnet_stat.c
  1321. src/collectors/proc.plugin/proc_net_stat_conntrack.c
  1322. src/collectors/proc.plugin/proc_net_stat_synproxy.c
  1323. src/collectors/proc.plugin/proc_self_mountinfo.c
  1324. src/collectors/proc.plugin/proc_self_mountinfo.h
  1325. src/collectors/proc.plugin/zfs_common.c
  1326. src/collectors/proc.plugin/zfs_common.h
  1327. src/collectors/proc.plugin/proc_spl_kstat_zfs.c
  1328. src/collectors/proc.plugin/proc_stat.c
  1329. src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
  1330. src/collectors/proc.plugin/proc_vmstat.c
  1331. src/collectors/proc.plugin/proc_uptime.c
  1332. src/collectors/proc.plugin/proc_pressure.c
  1333. src/collectors/proc.plugin/proc_pressure.h
  1334. src/collectors/proc.plugin/sys_kernel_mm_ksm.c
  1335. src/collectors/proc.plugin/sys_block_zram.c
  1336. src/collectors/proc.plugin/sys_devices_system_edac_mc.c
  1337. src/collectors/proc.plugin/sys_devices_system_node.c
  1338. src/collectors/proc.plugin/sys_class_infiniband.c
  1339. src/collectors/proc.plugin/sys_fs_btrfs.c
  1340. src/collectors/proc.plugin/sys_class_power_supply.c
  1341. src/collectors/proc.plugin/sys_devices_pci_aer.c
  1342. src/collectors/proc.plugin/sys_class_drm.c
  1343. )
  1344. set(TC_PLUGIN_FILES
  1345. src/collectors/tc.plugin/plugin_tc.c
  1346. )
  1347. set(NETDATA_FILES
  1348. src/collectors/all.h
  1349. ${DAEMON_FILES}
  1350. ${API_PLUGIN_FILES}
  1351. ${EXPORTING_ENGINE_FILES}
  1352. ${HEALTH_PLUGIN_FILES}
  1353. ${IDLEJITTER_PLUGIN_FILES}
  1354. ${ML_FILES}
  1355. ${PLUGINSD_PLUGIN_FILES}
  1356. ${RRD_PLUGIN_FILES}
  1357. ${REGISTRY_PLUGIN_FILES}
  1358. ${STATSD_PLUGIN_FILES}
  1359. ${STREAMING_PLUGIN_FILES}
  1360. ${WEB_PLUGIN_FILES}
  1361. ${CLAIM_PLUGIN_FILES}
  1362. ${ACLK_ALWAYS_BUILD}
  1363. ${PROFILE_PLUGIN_FILES}
  1364. )
  1365. if(OS_LINUX)
  1366. list(APPEND NETDATA_FILES
  1367. src/daemon/static_threads_linux.c
  1368. ${CGROUPS_PLUGIN_FILES}
  1369. ${DISKSPACE_PLUGIN_FILES}
  1370. ${PROC_PLUGIN_FILES}
  1371. ${TC_PLUGIN_FILES}
  1372. ${TIMEX_PLUGIN_FILES}
  1373. ${INTERNAL_COLLECTORS_FILES}
  1374. )
  1375. if(ENABLE_SENTRY)
  1376. list(APPEND NETDATA_FILES
  1377. src/daemon/sentry-native/sentry-native.c
  1378. src/daemon/sentry-native/sentry-native.h)
  1379. endif()
  1380. elseif(OS_MACOS)
  1381. list(APPEND NETDATA_FILES
  1382. src/daemon/static_threads_macos.c
  1383. ${MACOS_PLUGIN_FILES}
  1384. ${TIMEX_PLUGIN_FILES}
  1385. ${INTERNAL_COLLECTORS_FILES}
  1386. )
  1387. elseif(OS_FREEBSD)
  1388. list(APPEND NETDATA_FILES
  1389. src/daemon/static_threads_freebsd.c
  1390. ${FREEBSD_PLUGIN_FILES}
  1391. ${TIMEX_PLUGIN_FILES}
  1392. ${INTERNAL_COLLECTORS_FILES}
  1393. )
  1394. elseif(OS_WINDOWS)
  1395. list(APPEND NETDATA_FILES
  1396. src/daemon/static_threads_windows.c
  1397. src/daemon/winsvc.cc
  1398. ${WINDOWS_PLUGIN_FILES}
  1399. ${INTERNAL_COLLECTORS_FILES}
  1400. )
  1401. endif()
  1402. set(MQTT_WEBSOCKETS_FILES
  1403. src/aclk/mqtt_websockets/mqtt_wss_client.c
  1404. src/aclk/mqtt_websockets/mqtt_wss_client.h
  1405. src/aclk/mqtt_websockets/mqtt_wss_log.c
  1406. src/aclk/mqtt_websockets/mqtt_wss_log.h
  1407. src/aclk/mqtt_websockets/ws_client.c
  1408. src/aclk/mqtt_websockets/ws_client.h
  1409. src/aclk/mqtt_websockets/mqtt_ng.c
  1410. src/aclk/mqtt_websockets/mqtt_ng.h
  1411. src/aclk/mqtt_websockets/common_public.c
  1412. src/aclk/mqtt_websockets/common_public.h
  1413. src/aclk/mqtt_websockets/common_internal.h
  1414. )
  1415. set(ACLK_PROTO_DEFS
  1416. src/aclk/aclk-schemas/proto/aclk/v1/lib.proto
  1417. src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto
  1418. src/aclk/aclk-schemas/proto/agent/v1/connection.proto
  1419. src/aclk/aclk-schemas/proto/alarm/v1/config.proto
  1420. src/aclk/aclk-schemas/proto/alarm/v1/stream.proto
  1421. src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto
  1422. src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto
  1423. src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
  1424. src/aclk/aclk-schemas/proto/context/v1/context.proto
  1425. src/aclk/aclk-schemas/proto/context/v1/stream.proto
  1426. src/aclk/aclk-schemas/proto/agent/v1/cmds.proto
  1427. )
  1428. set(ACLK_FILES
  1429. src/aclk/aclk_query.c
  1430. src/aclk/aclk_query.h
  1431. src/aclk/aclk_query_queue.c
  1432. src/aclk/aclk_query_queue.h
  1433. src/aclk/aclk_otp.c
  1434. src/aclk/aclk_otp.h
  1435. src/aclk/aclk_tx_msgs.c
  1436. src/aclk/aclk_tx_msgs.h
  1437. src/aclk/aclk_rx_msgs.c
  1438. src/aclk/aclk_rx_msgs.h
  1439. src/aclk/aclk_alarm_api.c
  1440. src/aclk/aclk_alarm_api.h
  1441. src/aclk/aclk_contexts_api.c
  1442. src/aclk/aclk_contexts_api.h
  1443. src/aclk/schema-wrappers/connection.cc
  1444. src/aclk/schema-wrappers/connection.h
  1445. src/aclk/schema-wrappers/node_connection.cc
  1446. src/aclk/schema-wrappers/node_connection.h
  1447. src/aclk/schema-wrappers/node_creation.cc
  1448. src/aclk/schema-wrappers/node_creation.h
  1449. src/aclk/schema-wrappers/alarm_stream.cc
  1450. src/aclk/schema-wrappers/alarm_stream.h
  1451. src/aclk/schema-wrappers/alarm_config.cc
  1452. src/aclk/schema-wrappers/alarm_config.h
  1453. src/aclk/schema-wrappers/node_info.cc
  1454. src/aclk/schema-wrappers/node_info.h
  1455. src/aclk/schema-wrappers/capability.cc
  1456. src/aclk/schema-wrappers/capability.h
  1457. src/aclk/schema-wrappers/proto_2_json.cc
  1458. src/aclk/schema-wrappers/proto_2_json.h
  1459. src/aclk/schema-wrappers/context_stream.cc
  1460. src/aclk/schema-wrappers/context_stream.h
  1461. src/aclk/schema-wrappers/context.cc
  1462. src/aclk/schema-wrappers/context.h
  1463. src/aclk/schema-wrappers/schema_wrappers.h
  1464. src/aclk/schema-wrappers/schema_wrapper_utils.cc
  1465. src/aclk/schema-wrappers/schema_wrapper_utils.h
  1466. src/aclk/schema-wrappers/agent_cmds.cc
  1467. src/aclk/schema-wrappers/agent_cmds.h
  1468. )
  1469. set(MONGODB_EXPORTING_FILES
  1470. src/exporting/mongodb/mongodb.c
  1471. src/exporting/mongodb/mongodb.h
  1472. )
  1473. set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1474. src/exporting/prometheus/remote_write/remote_write.c
  1475. src/exporting/prometheus/remote_write/remote_write.h
  1476. src/exporting/prometheus/remote_write/remote_write_request.cc
  1477. src/exporting/prometheus/remote_write/remote_write_request.h
  1478. )
  1479. #
  1480. # build h2o
  1481. #
  1482. if(ENABLE_H2O)
  1483. add_library(h2o STATIC ${LIBH2O_FILES})
  1484. target_include_directories(h2o BEFORE PUBLIC
  1485. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include"
  1486. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/cloexec"
  1487. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/brotli/enc"
  1488. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/golombset"
  1489. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libgkc"
  1490. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libyrmcds"
  1491. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/klib"
  1492. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/neverbleed"
  1493. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picohttpparser"
  1494. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picotest"
  1495. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yaml/include"
  1496. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yoml"
  1497. )
  1498. target_compile_options(h2o PRIVATE
  1499. -Wno-all -Wno-extra
  1500. -Wno-shadow
  1501. -Wno-deprecated-declarations
  1502. -Wformat
  1503. )
  1504. target_compile_options(h2o PUBLIC -DH2O_USE_LIBUV=0)
  1505. target_link_libraries(h2o PRIVATE PkgConfig::TLS)
  1506. endif()
  1507. #
  1508. # build libjudy
  1509. #
  1510. add_library(judy STATIC ${LIBJUDY_SOURCES})
  1511. target_compile_options(judy PRIVATE
  1512. -Wno-all -Wno-extra
  1513. -Wno-shadow
  1514. -Wformat
  1515. )
  1516. target_compile_definitions(judy PRIVATE
  1517. JUDYL
  1518. $<$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>:JU_64BIT>
  1519. )
  1520. target_include_directories(judy PUBLIC
  1521. src/libnetdata/libjudy/src
  1522. src/libnetdata/libjudy/src/JudyCommon
  1523. )
  1524. set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV")
  1525. set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT")
  1526. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE")
  1527. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB")
  1528. set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL")
  1529. #
  1530. # build libnetdata
  1531. #
  1532. if(OS_LINUX)
  1533. include(NetdataDetectSystemd)
  1534. detect_systemd()
  1535. endif()
  1536. add_library(libnetdata STATIC ${LIBNETDATA_FILES})
  1537. target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)
  1538. # pthread (FIXME: use find_package for this)
  1539. # set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  1540. # set(THREADS_PREFER_PTHREAD_FLAG TRUE)
  1541. # find_package(Threads REQUIRED)
  1542. # add_executable(test test.cpp)
  1543. # target_link_libraries(test Threads::Threads)
  1544. target_link_libraries(libnetdata PUBLIC
  1545. "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>"
  1546. "$<$<OR:$<BOOL:${OS_LINUX}>,$<BOOL:${OS_FREEBSD}>>:pthread;rt>"
  1547. "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4>"
  1548. "$<$<BOOL:${LINK_LIBM}>:m>"
  1549. "${SYSTEMD_LDFLAGS}")
  1550. # ebpf
  1551. if(ENABLE_PLUGIN_EBPF)
  1552. netdata_add_libbpf_to_target(libnetdata)
  1553. endif()
  1554. # judy
  1555. target_link_libraries(libnetdata PUBLIC judy)
  1556. netdata_add_jsonc_to_target(libnetdata)
  1557. netdata_add_libyaml_to_target(libnetdata)
  1558. # zlib
  1559. if(OS_MACOS)
  1560. find_package(ZLIB REQUIRED)
  1561. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1562. target_link_libraries(libnetdata PUBLIC ZLIB::ZLIB)
  1563. else()
  1564. pkg_check_modules(ZLIB REQUIRED zlib)
  1565. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1566. target_compile_options(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER})
  1567. target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS})
  1568. endif()
  1569. # lz4 - try to find a version that is compatible with streaming compression
  1570. # otherwise pick whichever one we can find to support dbengine but don't set
  1571. # ENABLE_LZ4.
  1572. pkg_check_modules(LIBLZ4 liblz4>=1.9.0)
  1573. if(LIBLZ4_FOUND)
  1574. set(ENABLE_LZ4 On)
  1575. else()
  1576. pkg_check_modules(LIBLZ4 REQUIRED liblz4)
  1577. endif()
  1578. target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS})
  1579. target_compile_options(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER})
  1580. target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS})
  1581. # zstd
  1582. pkg_check_modules(LIBZSTD libzstd)
  1583. if(LIBZSTD_FOUND)
  1584. set(ENABLE_ZSTD On)
  1585. target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS})
  1586. target_compile_options(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER})
  1587. target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS})
  1588. endif()
  1589. # brotli
  1590. pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon)
  1591. if(LIBBROTLI_FOUND)
  1592. set(ENABLE_BROTLI On)
  1593. target_include_directories(libnetdata PUBLIC ${LIBBROTLI_INCLUDE_DIRS})
  1594. target_compile_options(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER})
  1595. target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS})
  1596. endif()
  1597. # uuid
  1598. if(OS_MACOS OR OS_WINDOWS)
  1599. # UUID functionality is part of the system libraries here, so no extra
  1600. # stuff needed.
  1601. else()
  1602. pkg_check_modules(UUID REQUIRED uuid)
  1603. target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS})
  1604. target_compile_options(libnetdata PUBLIC ${UUID_CFLAGS_OTHER})
  1605. target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS})
  1606. endif()
  1607. # uv
  1608. pkg_check_modules(LIBUV REQUIRED libuv)
  1609. target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS})
  1610. target_compile_options(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER})
  1611. target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS})
  1612. # crypto
  1613. target_link_libraries(libnetdata PUBLIC PkgConfig::CRYPTO)
  1614. # openssl
  1615. target_link_libraries(libnetdata PUBLIC PkgConfig::TLS)
  1616. # mnl
  1617. if(NOT OS_MACOS)
  1618. pkg_check_modules(MNL libmnl)
  1619. if(MNL_FOUND)
  1620. set(HAVE_LIBMNL True)
  1621. endif()
  1622. endif()
  1623. #
  1624. # mqtt library
  1625. #
  1626. set(ENABLE_MQTTWEBSOCKETS True)
  1627. if(ENABLE_MQTTWEBSOCKETS)
  1628. add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
  1629. target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC
  1630. -DRBUF_CUSTOM_MALLOC
  1631. -DMQTT_WSS_CPUSTATS)
  1632. target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers
  1633. ${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include)
  1634. target_link_libraries(mqttwebsockets PRIVATE libnetdata)
  1635. endif()
  1636. #
  1637. # proto definitions
  1638. #
  1639. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1640. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1641. ACLK_PROTO_BUILT_SRCS
  1642. ACLK_PROTO_BUILT_HDRS
  1643. ${ACLK_PROTO_DEFS})
  1644. list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS}
  1645. ${ACLK_PROTO_BUILT_HDRS})
  1646. #
  1647. # build plugins
  1648. #
  1649. if(ENABLE_PLUGIN_DEBUGFS)
  1650. pkg_check_modules(CAP QUIET libcap)
  1651. set(DEBUGFS_PLUGIN_FILES src/collectors/debugfs.plugin/debugfs_plugin.c
  1652. src/collectors/debugfs.plugin/debugfs_plugin.h
  1653. src/collectors/debugfs.plugin/debugfs_extfrag.c
  1654. src/collectors/debugfs.plugin/debugfs_zswap.c
  1655. src/collectors/debugfs.plugin/sys_devices_virtual_powercap.c)
  1656. add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES})
  1657. target_link_libraries(debugfs.plugin libnetdata ${CAP_LIBRARIES})
  1658. target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1659. target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1660. install(TARGETS debugfs.plugin
  1661. COMPONENT plugin-debugfs
  1662. DESTINATION usr/libexec/netdata/plugins.d)
  1663. if(BUILD_FOR_PACKAGING)
  1664. install(FILES
  1665. ${PKG_FILES_PATH}/copyright
  1666. COMPONENT plugin-debugfs
  1667. DESTINATION usr/share/doc/netdata-plugin-debugfs)
  1668. endif()
  1669. endif()
  1670. add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c)
  1671. target_link_libraries(spawn-tester libnetdata)
  1672. if(ENABLE_PLUGIN_APPS)
  1673. pkg_check_modules(CAP QUIET libcap)
  1674. set(APPS_PLUGIN_FILES
  1675. src/collectors/apps.plugin/apps_plugin.c
  1676. src/collectors/apps.plugin/apps_plugin.h
  1677. src/collectors/apps.plugin/apps_functions.c
  1678. src/collectors/apps.plugin/apps_targets.c
  1679. src/collectors/apps.plugin/apps_users_and_groups.c
  1680. src/collectors/apps.plugin/apps_output.c
  1681. src/collectors/apps.plugin/apps_proc_pid_status.c
  1682. src/collectors/apps.plugin/apps_proc_pid_limits.c
  1683. src/collectors/apps.plugin/apps_proc_pid_stat.c
  1684. src/collectors/apps.plugin/apps_proc_pid_cmdline.c
  1685. src/collectors/apps.plugin/apps_proc_pid_io.c
  1686. src/collectors/apps.plugin/apps_proc_stat.c
  1687. src/collectors/apps.plugin/apps_proc_pid_fd.c
  1688. src/collectors/apps.plugin/apps_proc_pids.c
  1689. src/collectors/apps.plugin/apps_proc_meminfo.c
  1690. )
  1691. add_executable(apps.plugin ${APPS_PLUGIN_FILES})
  1692. target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES})
  1693. target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1694. target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1695. install(TARGETS apps.plugin
  1696. COMPONENT plugin-apps
  1697. DESTINATION usr/libexec/netdata/plugins.d)
  1698. install(FILES src/collectors/apps.plugin/apps_groups.conf
  1699. COMPONENT plugin-apps
  1700. DESTINATION usr/lib/netdata/conf.d)
  1701. if(BUILD_FOR_PACKAGING)
  1702. install(FILES
  1703. ${PKG_FILES_PATH}/copyright
  1704. COMPONENT plugin-apps
  1705. DESTINATION usr/share/doc/netdata-plugin-apps)
  1706. endif()
  1707. endif()
  1708. if(CAP_FOUND)
  1709. set(HAVE_CAPABILITY True)
  1710. endif()
  1711. if(ENABLE_PLUGIN_FREEIPMI)
  1712. pkg_check_modules(IPMI REQUIRED libipmimonitoring)
  1713. set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c)
  1714. add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES})
  1715. target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES})
  1716. target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS})
  1717. target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER})
  1718. install(TARGETS freeipmi.plugin
  1719. COMPONENT plugin-freeipmi
  1720. DESTINATION usr/libexec/netdata/plugins.d)
  1721. if(BUILD_FOR_PACKAGING)
  1722. install(FILES
  1723. ${PKG_FILES_PATH}/copyright
  1724. COMPONENT plugin-freeipmi
  1725. DESTINATION usr/share/doc/netdata-plugin-freeipmi)
  1726. endif()
  1727. endif()
  1728. if(ENABLE_PLUGIN_NFACCT)
  1729. if (NOT MNL_FOUND)
  1730. message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.")
  1731. endif()
  1732. pkg_check_modules(NFACCT REQUIRED libnetfilter_acct)
  1733. set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c)
  1734. add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES})
  1735. target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES})
  1736. target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS})
  1737. target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER})
  1738. install(TARGETS nfacct.plugin
  1739. COMPONENT plugin-nfacct
  1740. DESTINATION usr/libexec/netdata/plugins.d)
  1741. if(BUILD_FOR_PACKAGING)
  1742. install(FILES
  1743. ${PKG_FILES_PATH}/copyright
  1744. COMPONENT plugin-nfacct
  1745. DESTINATION usr/share/doc/netdata-plugin-nfacct)
  1746. endif()
  1747. endif()
  1748. if(ENABLE_PLUGIN_XENSTAT)
  1749. pkg_check_modules(XENSTAT REQUIRED xenstat)
  1750. pkg_check_modules(XENLIGHT REQUIRED xenlight)
  1751. set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c)
  1752. add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES})
  1753. target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES})
  1754. target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS})
  1755. target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER})
  1756. install(TARGETS xenstat.plugin
  1757. COMPONENT plugin-xenstat
  1758. DESTINATION usr/libexec/netdata/plugins.d)
  1759. if(BUILD_FOR_PACKAGING)
  1760. install(FILES
  1761. ${PKG_FILES_PATH}/copyright
  1762. COMPONENT plugin-xenstat
  1763. DESTINATION usr/share/doc/netdata-plugin-xenstat)
  1764. endif()
  1765. endif()
  1766. if(ENABLE_PLUGIN_PERF)
  1767. set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c)
  1768. add_executable(perf.plugin ${PERF_PLUGIN_FILES})
  1769. target_link_libraries(perf.plugin libnetdata)
  1770. install(TARGETS perf.plugin
  1771. COMPONENT plugin-perf
  1772. DESTINATION usr/libexec/netdata/plugins.d)
  1773. if(BUILD_FOR_PACKAGING)
  1774. install(FILES
  1775. ${PKG_FILES_PATH}/copyright
  1776. COMPONENT plugin-perf
  1777. DESTINATION usr/share/doc/netdata-plugin-perf)
  1778. endif()
  1779. endif()
  1780. if(ENABLE_PLUGIN_SLABINFO)
  1781. set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c)
  1782. add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES})
  1783. target_link_libraries(slabinfo.plugin libnetdata)
  1784. install(TARGETS slabinfo.plugin
  1785. COMPONENT plugin-slabinfo
  1786. DESTINATION usr/libexec/netdata/plugins.d)
  1787. if(BUILD_FOR_PACKAGING)
  1788. install(FILES
  1789. ${PKG_FILES_PATH}/copyright
  1790. COMPONENT plugin-slabinfo
  1791. DESTINATION usr/share/doc/netdata-plugin-slabinfo)
  1792. endif()
  1793. endif()
  1794. if(ENABLE_PLUGIN_CUPS)
  1795. pkg_check_modules(CUPS libcups)
  1796. if(NOT CUPS_FOUND)
  1797. pkg_check_modules(CUPS cups)
  1798. if(NOT CUPS_FOUND)
  1799. find_program(CUPS_CONFIG cups-config)
  1800. if(CUPS_CONFIG)
  1801. execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  1802. if(CUPS_API_VERSION VERSION_LESS "1.7")
  1803. set(CUPS_FOUND False)
  1804. else()
  1805. execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE)
  1806. execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
  1807. set(CUPS_FOUND True)
  1808. endif()
  1809. endif()
  1810. endif()
  1811. endif()
  1812. if(NOT CUPS_FOUND)
  1813. message(WARNING "Could not find cups cflags and libs.")
  1814. else()
  1815. set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c)
  1816. add_executable(cups.plugin ${CUPS_PLUGIN_FILES})
  1817. target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES})
  1818. target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER})
  1819. install(TARGETS cups.plugin
  1820. COMPONENT plugin-cups
  1821. DESTINATION usr/libexec/netdata/plugins.d)
  1822. if(BUILD_FOR_PACKAGING)
  1823. install(FILES
  1824. ${PKG_FILES_PATH}/copyright
  1825. COMPONENT plugin-cups
  1826. DESTINATION usr/share/doc/netdata-plugin-cups)
  1827. endif()
  1828. endif()
  1829. endif()
  1830. if(NEED_NDSUDO)
  1831. set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c)
  1832. add_executable(ndsudo ${NDSUDO_FILES})
  1833. install(TARGETS ndsudo
  1834. COMPONENT netdata
  1835. DESTINATION usr/libexec/netdata/plugins.d)
  1836. endif()
  1837. if(ENABLE_PLUGIN_CGROUP_NETWORK)
  1838. set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c)
  1839. add_executable(cgroup-network ${CGROUP_NETWORK_FILES})
  1840. target_link_libraries(cgroup-network libnetdata)
  1841. install(TARGETS cgroup-network
  1842. COMPONENT netdata
  1843. DESTINATION usr/libexec/netdata/plugins.d)
  1844. endif()
  1845. if(ENABLE_PLUGIN_SYSTEMD_JOURNAL)
  1846. if(NOT SYSTEMD_FOUND)
  1847. message(FATAL_ERROR "Systemd journal plugin requires systemd, but systemd was not found.")
  1848. endif()
  1849. add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES})
  1850. target_link_libraries(systemd-journal.plugin libnetdata)
  1851. install(TARGETS systemd-journal.plugin
  1852. COMPONENT plugin-systemd-journal
  1853. DESTINATION usr/libexec/netdata/plugins.d)
  1854. if(BUILD_FOR_PACKAGING)
  1855. install(FILES
  1856. ${PKG_FILES_PATH}/copyright
  1857. COMPONENT plugin-systemd-journal
  1858. DESTINATION usr/share/doc/netdata-plugin-systemd-journal)
  1859. endif()
  1860. endif()
  1861. if(OS_WINDOWS)
  1862. add_executable(windows-events.plugin ${WINDOWS_EVENTS_PLUGIN_FILES})
  1863. target_link_libraries(windows-events.plugin libnetdata wevtapi)
  1864. install(TARGETS windows-events.plugin
  1865. COMPONENT plugin-windows-events
  1866. DESTINATION usr/libexec/netdata/plugins.d)
  1867. endif()
  1868. if(ENABLE_PLUGIN_EBPF)
  1869. set(EBPF_PLUGIN_FILES
  1870. src/collectors/ebpf.plugin/ebpf.c
  1871. src/collectors/ebpf.plugin/ebpf.h
  1872. src/collectors/ebpf.plugin/ebpf_cachestat.c
  1873. src/collectors/ebpf.plugin/ebpf_cachestat.h
  1874. src/collectors/ebpf.plugin/ebpf_dcstat.c
  1875. src/collectors/ebpf.plugin/ebpf_dcstat.h
  1876. src/collectors/ebpf.plugin/ebpf_disk.c
  1877. src/collectors/ebpf.plugin/ebpf_disk.h
  1878. src/collectors/ebpf.plugin/ebpf_fd.c
  1879. src/collectors/ebpf.plugin/ebpf_fd.h
  1880. src/collectors/ebpf.plugin/ebpf_hardirq.c
  1881. src/collectors/ebpf.plugin/ebpf_hardirq.h
  1882. src/collectors/ebpf.plugin/ebpf_mdflush.c
  1883. src/collectors/ebpf.plugin/ebpf_mdflush.h
  1884. src/collectors/ebpf.plugin/ebpf_mount.c
  1885. src/collectors/ebpf.plugin/ebpf_mount.h
  1886. src/collectors/ebpf.plugin/ebpf_filesystem.c
  1887. src/collectors/ebpf.plugin/ebpf_filesystem.h
  1888. src/collectors/ebpf.plugin/ebpf_oomkill.c
  1889. src/collectors/ebpf.plugin/ebpf_oomkill.h
  1890. src/collectors/ebpf.plugin/ebpf_process.c
  1891. src/collectors/ebpf.plugin/ebpf_process.h
  1892. src/collectors/ebpf.plugin/ebpf_shm.c
  1893. src/collectors/ebpf.plugin/ebpf_shm.h
  1894. src/collectors/ebpf.plugin/ebpf_socket.c
  1895. src/collectors/ebpf.plugin/ebpf_socket.h
  1896. src/collectors/ebpf.plugin/ebpf_softirq.c
  1897. src/collectors/ebpf.plugin/ebpf_softirq.h
  1898. src/collectors/ebpf.plugin/ebpf_sync.c
  1899. src/collectors/ebpf.plugin/ebpf_sync.h
  1900. src/collectors/ebpf.plugin/ebpf_swap.c
  1901. src/collectors/ebpf.plugin/ebpf_swap.h
  1902. src/collectors/ebpf.plugin/ebpf_vfs.c
  1903. src/collectors/ebpf.plugin/ebpf_vfs.h
  1904. src/collectors/ebpf.plugin/ebpf_apps.c
  1905. src/collectors/ebpf.plugin/ebpf_apps.h
  1906. src/collectors/ebpf.plugin/ebpf_cgroup.c
  1907. src/collectors/ebpf.plugin/ebpf_cgroup.h
  1908. src/collectors/ebpf.plugin/ebpf_unittest.c
  1909. src/collectors/ebpf.plugin/ebpf_unittest.h
  1910. src/collectors/ebpf.plugin/ebpf_functions.c
  1911. src/collectors/ebpf.plugin/ebpf_functions.h
  1912. )
  1913. add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES})
  1914. target_link_libraries(ebpf.plugin libnetdata)
  1915. netdata_add_ebpf_co_re_to_target(ebpf.plugin)
  1916. install(TARGETS ebpf.plugin
  1917. COMPONENT plugin-ebpf
  1918. DESTINATION usr/libexec/netdata/plugins.d)
  1919. install(FILES
  1920. src/collectors/ebpf.plugin/ebpf.d.conf
  1921. COMPONENT plugin-ebpf
  1922. DESTINATION usr/lib/netdata/conf.d)
  1923. install(FILES
  1924. src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
  1925. src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
  1926. src/collectors/ebpf.plugin/ebpf.d/disk.conf
  1927. src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt
  1928. src/collectors/ebpf.plugin/ebpf.d/fd.conf
  1929. src/collectors/ebpf.plugin/ebpf.d/filesystem.conf
  1930. src/collectors/ebpf.plugin/ebpf.d/hardirq.conf
  1931. src/collectors/ebpf.plugin/ebpf.d/mdflush.conf
  1932. src/collectors/ebpf.plugin/ebpf.d/mount.conf
  1933. src/collectors/ebpf.plugin/ebpf.d/network.conf
  1934. src/collectors/ebpf.plugin/ebpf.d/oomkill.conf
  1935. src/collectors/ebpf.plugin/ebpf.d/process.conf
  1936. src/collectors/ebpf.plugin/ebpf.d/shm.conf
  1937. src/collectors/ebpf.plugin/ebpf.d/softirq.conf
  1938. src/collectors/ebpf.plugin/ebpf.d/swap.conf
  1939. src/collectors/ebpf.plugin/ebpf.d/sync.conf
  1940. src/collectors/ebpf.plugin/ebpf.d/vfs.conf
  1941. COMPONENT plugin-ebpf
  1942. DESTINATION usr/lib/netdata/conf.d/ebpf.d)
  1943. if(BUILD_FOR_PACKAGING)
  1944. install(FILES
  1945. ${PKG_FILES_PATH}/copyright
  1946. COMPONENT plugin-ebpf
  1947. DESTINATION usr/share/doc/netdata-plugin-ebpf)
  1948. endif()
  1949. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  1950. netdata_install_legacy_ebpf_code()
  1951. endif()
  1952. endif()
  1953. if(ENABLE_PLUGIN_LOCAL_LISTENERS)
  1954. set(LOCAL_LISTENERS_FILES
  1955. src/collectors/plugins.d/local_listeners.c
  1956. src/libnetdata/maps/local-sockets.h
  1957. )
  1958. add_executable(local-listeners ${LOCAL_LISTENERS_FILES})
  1959. target_compile_options(local-listeners PRIVATE
  1960. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1961. target_include_directories(local-listeners PRIVATE
  1962. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1963. target_link_libraries(local-listeners libnetdata
  1964. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1965. install(TARGETS local-listeners
  1966. COMPONENT netdata
  1967. DESTINATION usr/libexec/netdata/plugins.d)
  1968. endif()
  1969. if(ENABLE_PLUGIN_NETWORK_VIEWER)
  1970. set(NETWORK_VIEWER_FILES
  1971. src/libnetdata/maps/local-sockets.h
  1972. src/libnetdata/maps/system-users.h
  1973. src/collectors/network-viewer.plugin/network-viewer.c
  1974. )
  1975. add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES})
  1976. target_compile_options(network-viewer.plugin PRIVATE
  1977. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1978. target_include_directories(network-viewer.plugin PRIVATE
  1979. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1980. target_link_libraries(network-viewer.plugin libnetdata
  1981. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1982. install(TARGETS network-viewer.plugin
  1983. COMPONENT plugin-network-viewer
  1984. DESTINATION usr/libexec/netdata/plugins.d)
  1985. if(BUILD_FOR_PACKAGING)
  1986. install(FILES
  1987. ${PKG_FILES_PATH}/copyright
  1988. COMPONENT plugin-network-viewer
  1989. DESTINATION usr/share/doc/netdata-plugin-network-viewer)
  1990. endif()
  1991. endif()
  1992. #
  1993. # exporters
  1994. #
  1995. if(ENABLE_EXPORTER_MONGODB)
  1996. pkg_check_modules(MONGOC libmongoc-1.0>=1.7)
  1997. if(MONGOC_FOUND)
  1998. SET(HAVE_MONGOC True)
  1999. else()
  2000. SET(ENABLE_EXPORTER_MONGODB False)
  2001. endif()
  2002. endif()
  2003. if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
  2004. pkg_check_modules(SNAPPY snappy)
  2005. if (NOT SNAPPY_FOUND)
  2006. include(CheckLibraryExists)
  2007. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
  2008. if(HAVE_SNAPPY_LIB)
  2009. set(SNAPPY_INCLUDE_DIRS "")
  2010. set(SNAPPY_CFLAGS_OTHER "")
  2011. set(SNAPPY_LIBRARIES "-lsnappy")
  2012. else()
  2013. message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.")
  2014. endif()
  2015. endif()
  2016. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  2017. "${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  2018. PROMETHEUS_REMOTE_WRITE_BUILT_SRCS
  2019. PROMETHEUS_REMOTE_WRITE_BUILT_HDRS
  2020. "src/exporting/prometheus/remote_write/remote_write.proto")
  2021. list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  2022. ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS}
  2023. ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS})
  2024. set(ENABLE_PROMETHEUS_REMOTE_WRITE True)
  2025. endif()
  2026. #
  2027. # build netdata (only Linux ATM)
  2028. #
  2029. if(OS_WINDOWS)
  2030. set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
  2031. configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY)
  2032. set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc")
  2033. configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY)
  2034. set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
  2035. configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
  2036. endif()
  2037. add_executable(netdata
  2038. ${NETDATA_FILES}
  2039. "${ACLK_FILES}"
  2040. "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>"
  2041. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
  2042. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
  2043. "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>"
  2044. )
  2045. if(OS_WINDOWS)
  2046. add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
  2047. target_link_libraries(NetdataClaim shell32;gdi32;msftedit)
  2048. target_compile_options(NetdataClaim PUBLIC -mwindows)
  2049. endif()
  2050. target_compile_definitions(netdata PRIVATE
  2051. "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>"
  2052. )
  2053. target_compile_options(netdata PRIVATE
  2054. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_CFLAGS_OTHER}>"
  2055. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_CFLAGS_OTHER}>"
  2056. )
  2057. target_include_directories(netdata PRIVATE
  2058. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  2059. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
  2060. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
  2061. )
  2062. target_link_libraries(netdata PRIVATE
  2063. m
  2064. libnetdata
  2065. "$<$<BOOL:${OS_LINUX}>:rt>"
  2066. "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:mqttwebsockets>"
  2067. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_LIBRARIES}>"
  2068. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_LIBRARIES}>"
  2069. "$<$<BOOL:${OS_MACOS}>:${IOKIT};${FOUNDATION}>"
  2070. "$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
  2071. "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
  2072. "$<$<BOOL:${ENABLE_H2O}>:h2o>"
  2073. "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>"
  2074. )
  2075. if(NEED_PROTOBUF)
  2076. netdata_add_protobuf(netdata)
  2077. endif()
  2078. #
  2079. # build systemd-cat-native
  2080. #
  2081. set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c
  2082. src/libnetdata/log/systemd-cat-native.h)
  2083. add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES})
  2084. target_link_libraries(systemd-cat-native libnetdata)
  2085. install(TARGETS systemd-cat-native
  2086. COMPONENT netdata
  2087. DESTINATION "${BINDIR}")
  2088. #
  2089. # build log2journal
  2090. #
  2091. pkg_check_modules(PCRE2 libpcre2-8)
  2092. if(PCRE2_FOUND)
  2093. set(LOG2JOURNAL_FILES
  2094. ${CONFIG_H}
  2095. src/collectors/log2journal/log2journal.h
  2096. src/collectors/log2journal/log2journal.c
  2097. src/collectors/log2journal/log2journal-help.c
  2098. src/collectors/log2journal/log2journal-yaml.c
  2099. src/collectors/log2journal/log2journal-json.c
  2100. src/collectors/log2journal/log2journal-logfmt.c
  2101. src/collectors/log2journal/log2journal-pcre2.c
  2102. src/collectors/log2journal/log2journal-params.c
  2103. src/collectors/log2journal/log2journal-inject.c
  2104. src/collectors/log2journal/log2journal-pattern.c
  2105. src/collectors/log2journal/log2journal-replace.c
  2106. src/collectors/log2journal/log2journal-rename.c
  2107. src/collectors/log2journal/log2journal-rewrite.c
  2108. )
  2109. add_executable(log2journal ${LOG2JOURNAL_FILES})
  2110. target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS})
  2111. target_compile_options(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER})
  2112. target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}")
  2113. netdata_add_libyaml_to_target(log2journal)
  2114. install(TARGETS log2journal
  2115. COMPONENT netdata
  2116. DESTINATION "${BINDIR}")
  2117. install(DIRECTORY src/collectors/log2journal/log2journal.d
  2118. COMPONENT netdata
  2119. DESTINATION usr/lib/netdata/conf.d)
  2120. endif()
  2121. #
  2122. # build netdatacli
  2123. #
  2124. set(NETDATACLI_FILES
  2125. src/daemon/commands.h
  2126. src/daemon/pipename.c
  2127. src/daemon/pipename.h
  2128. src/cli/cli.c
  2129. )
  2130. add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>")
  2131. target_link_libraries(netdatacli libnetdata)
  2132. install(TARGETS netdatacli
  2133. COMPONENT netdata
  2134. DESTINATION "${BINDIR}")
  2135. #
  2136. # Build go.d.plugin
  2137. #
  2138. if(ENABLE_PLUGIN_GO)
  2139. add_go_target(go-plugin go.d.plugin src/go cmd/godplugin)
  2140. install(PROGRAMS ${CMAKE_BINARY_DIR}/go.d.plugin
  2141. COMPONENT plugin-go
  2142. DESTINATION usr/libexec/netdata/plugins.d)
  2143. endif()
  2144. #
  2145. # Generate config file
  2146. #
  2147. if(NOT NETDATA_RUNTIME_PREFIX STREQUAL "")
  2148. string(REGEX REPLACE "/$" "" NETDATA_RUNTIME_PREFIX "${NETDATA_RUNTIME_PREFIX}")
  2149. endif()
  2150. set(CACHE_DIR "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2151. set(CONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2152. set(LIBCONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2153. set(LOG_DIR "${NETDATA_RUNTIME_PREFIX}/var/log/netdata")
  2154. set(PLUGINS_DIR "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata/plugins.d")
  2155. set(VARLIB_DIR "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2156. # A non-default value is only used when building Debian packages (/var/lib/netdata/www)
  2157. if(NOT DEFINED WEB_DIR)
  2158. set(WEB_DIR "usr/share/netdata/web")
  2159. else()
  2160. string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}")
  2161. endif()
  2162. set(WEB_DEST "${WEB_DIR}")
  2163. set(WEB_DIR "${NETDATA_RUNTIME_PREFIX}/${WEB_DEST}")
  2164. set(CONFIGURE_COMMAND "dummy-configure-command")
  2165. if (NOT NETDATA_USER)
  2166. set(NETDATA_USER "netdata")
  2167. endif()
  2168. configure_file(packaging/cmake/config.cmake.h.in config.h)
  2169. #
  2170. # install
  2171. #
  2172. install(TARGETS netdata COMPONENT netdata DESTINATION "${BINDIR}")
  2173. install(DIRECTORY COMPONENT netdata DESTINATION var/cache/netdata)
  2174. install(DIRECTORY COMPONENT netdata DESTINATION var/log/netdata)
  2175. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/registry)
  2176. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/cloud.d)
  2177. install(DIRECTORY COMPONENT netdata DESTINATION var/run/netdata)
  2178. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata)
  2179. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/custom-plugins.d)
  2180. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/health.d)
  2181. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/ssl)
  2182. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/statsd.d)
  2183. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d)
  2184. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d/schema.d)
  2185. install(DIRECTORY COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d)
  2186. install(DIRECTORY COMPONENT netdata DESTINATION ${WEB_DEST})
  2187. set(libsysdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/system")
  2188. set(pkglibexecdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata")
  2189. set(localstatedir_POST "${NETDATA_RUNTIME_PREFIX}/var")
  2190. set(sbindir_POST "${NETDATA_RUNTIME_PREFIX}/${BINDIR}")
  2191. set(configdir_POST "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2192. set(libconfigdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2193. set(cachedir_POST "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2194. set(registrydir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata/registry")
  2195. set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2196. set(netdata_user_POST "${NETDATA_USER}")
  2197. set(netdata_group_POST "${NETDATA_USER}")
  2198. if(NOT OS_WINDOWS)
  2199. configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
  2200. install(PROGRAMS
  2201. ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
  2202. COMPONENT netdata
  2203. DESTINATION "${BINDIR}")
  2204. else()
  2205. install(PROGRAMS
  2206. ${CMAKE_BINARY_DIR}/NetdataClaim.exe
  2207. COMPONENT netdata
  2208. DESTINATION "${BINDIR}")
  2209. endif()
  2210. #
  2211. # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume
  2212. # the files exists unconditionally.
  2213. #
  2214. configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in
  2215. src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY)
  2216. install(PROGRAMS
  2217. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh
  2218. COMPONENT netdata
  2219. DESTINATION usr/libexec/netdata/plugins.d)
  2220. configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in
  2221. src/collectors/cgroups.plugin/cgroup-name.sh @ONLY)
  2222. install(PROGRAMS
  2223. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh
  2224. COMPONENT netdata
  2225. DESTINATION usr/libexec/netdata/plugins.d)
  2226. #
  2227. # statsd
  2228. #
  2229. install(FILES
  2230. src/collectors/statsd.plugin/asterisk.conf
  2231. src/collectors/statsd.plugin/example.conf
  2232. src/collectors/statsd.plugin/k6.conf
  2233. COMPONENT netdata
  2234. DESTINATION usr/lib/netdata/conf.d/statsd.d)
  2235. #
  2236. # exporting
  2237. #
  2238. install(FILES
  2239. src/exporting/exporting.conf
  2240. COMPONENT netdata
  2241. DESTINATION usr/lib/netdata/conf.d)
  2242. #
  2243. # ioping.plugin
  2244. #
  2245. install(FILES
  2246. src/collectors/ioping.plugin/ioping.conf
  2247. COMPONENT netdata
  2248. DESTINATION usr/lib/netdata/conf.d)
  2249. #
  2250. # streaming
  2251. #
  2252. install(FILES
  2253. src/streaming/stream.conf
  2254. COMPONENT netdata
  2255. DESTINATION usr/lib/netdata/conf.d)
  2256. #
  2257. # swagger
  2258. #
  2259. install(FILES
  2260. src/web/api/netdata-swagger.json
  2261. src/web/api/netdata-swagger.yaml
  2262. COMPONENT netdata
  2263. DESTINATION ${WEB_DEST})
  2264. #
  2265. # service files
  2266. #
  2267. configure_file(system/install-service.sh.in system/install-service.sh @ONLY)
  2268. install(PROGRAMS
  2269. ${CMAKE_BINARY_DIR}/system/install-service.sh
  2270. COMPONENT netdata
  2271. DESTINATION usr/libexec/netdata)
  2272. configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY)
  2273. install(FILES
  2274. ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist
  2275. COMPONENT netdata
  2276. DESTINATION usr/lib/netdata/system/launchd)
  2277. configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY)
  2278. install(FILES
  2279. ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata
  2280. COMPONENT netdata
  2281. DESTINATION usr/lib/netdata/system/freebsd/rc.d)
  2282. configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY)
  2283. install(FILES
  2284. ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata
  2285. COMPONENT netdata
  2286. DESTINATION usr/lib/netdata/system/initd/init.d)
  2287. configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY)
  2288. install(FILES
  2289. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2290. COMPONENT netdata
  2291. DESTINATION usr/lib/netdata/system/logrotate)
  2292. install(FILES
  2293. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2294. COMPONENT netdata
  2295. DESTINATION etc/logrotate.d)
  2296. configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY)
  2297. install(FILES
  2298. ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata
  2299. COMPONENT netdata
  2300. DESTINATION usr/lib/netdata/system/lsb/init.d)
  2301. configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY)
  2302. install(FILES
  2303. ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata
  2304. COMPONENT netdata
  2305. DESTINATION usr/lib/netdata/system/openrc/conf.d)
  2306. configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY)
  2307. install(FILES
  2308. ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata
  2309. COMPONENT netdata
  2310. DESTINATION usr/lib/netdata/system/openrc/init.d)
  2311. configure_file(system/runit/run.in system/runit/run @ONLY)
  2312. install(FILES
  2313. ${CMAKE_BINARY_DIR}/system/runit/run
  2314. COMPONENT netdata
  2315. DESTINATION usr/lib/netdata/system/runit)
  2316. configure_file(system/dinit/netdata.in system/dinit/netdata @ONLY)
  2317. install(FILES
  2318. ${CMAKE_BINARY_DIR}/system/dinit/netdata
  2319. COMPONENT netdata
  2320. DESTINATION usr/lib/netdata/system/dinit)
  2321. configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY)
  2322. install(FILES
  2323. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2324. COMPONENT netdata
  2325. DESTINATION usr/lib/netdata/system/systemd)
  2326. install(FILES
  2327. system/systemd/journald@netdata.conf
  2328. COMPONENT netdata
  2329. DESTINATION usr/lib/netdata/system/systemd)
  2330. configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY)
  2331. install(FILES
  2332. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235
  2333. COMPONENT netdata
  2334. DESTINATION usr/lib/netdata/system/systemd)
  2335. if(BUILD_FOR_PACKAGING)
  2336. install(FILES
  2337. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2338. COMPONENT netdata
  2339. DESTINATION lib/systemd/system)
  2340. install(DIRECTORY
  2341. COMPONENT netdata
  2342. DESTINATION usr/lib/systemd/journald@netdata.conf.d)
  2343. install(FILES
  2344. system/systemd/journald@netdata.conf
  2345. COMPONENT netdata
  2346. DESTINATION usr/lib/systemd/journald@netdata.conf.d
  2347. RENAME netdata.conf)
  2348. endif()
  2349. install(FILES
  2350. system/systemd/50-netdata.preset
  2351. COMPONENT netdata
  2352. DESTINATION usr/lib/netdata/system/systemd)
  2353. install(FILES
  2354. system/vnodes/vnodes.conf
  2355. COMPONENT netdata
  2356. DESTINATION usr/lib/netdata/conf.d/vnodes)
  2357. install(FILES
  2358. system/.install-type
  2359. COMPONENT netdata
  2360. DESTINATION etc/netdata)
  2361. install(PROGRAMS
  2362. system/edit-config
  2363. COMPONENT netdata
  2364. DESTINATION etc/netdata)
  2365. if(BUILD_FOR_PACKAGING)
  2366. set(NETDATA_CONF_DEST "etc/netdata")
  2367. else()
  2368. set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d")
  2369. endif()
  2370. #
  2371. # misc files
  2372. #
  2373. if(BUILD_FOR_PACKAGING)
  2374. install(FILES
  2375. ${PKG_FILES_PATH}/deb/netdata/etc/default/netdata
  2376. COMPONENT netdata
  2377. DESTINATION etc/default)
  2378. install(PROGRAMS
  2379. ${PKG_FILES_PATH}/deb/netdata/etc/init.d/netdata
  2380. COMPONENT netdata
  2381. DESTINATION etc/init.d)
  2382. endif()
  2383. if(NOT OS_WINDOWS)
  2384. install(PROGRAMS
  2385. packaging/installer/netdata-updater.sh
  2386. COMPONENT netdata
  2387. DESTINATION usr/libexec/netdata)
  2388. install(FILES
  2389. system/netdata.conf
  2390. system/netdata-updater.conf
  2391. COMPONENT netdata
  2392. DESTINATION ${NETDATA_CONF_DEST})
  2393. configure_file(system/cron/netdata-updater-daily.in
  2394. system/cron/netdata-updater-daily
  2395. @ONLY)
  2396. install(FILES
  2397. ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily
  2398. COMPONENT netdata
  2399. DESTINATION usr/lib/netdata/system/cron)
  2400. configure_file(system/systemd/netdata-updater.service.in
  2401. system/systemd/netdata-updater.service
  2402. @ONLY)
  2403. install(FILES
  2404. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2405. COMPONENT netdata
  2406. DESTINATION usr/lib/netdata/system/systemd)
  2407. install(FILES
  2408. system/systemd/netdata-updater.timer
  2409. COMPONENT netdata
  2410. DESTINATION usr/lib/netdata/system/systemd)
  2411. if(BUILD_FOR_PACKAGING)
  2412. install(FILES
  2413. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2414. COMPONENT netdata
  2415. DESTINATION lib/systemd/system)
  2416. install(FILES
  2417. system/systemd/netdata-updater.timer
  2418. COMPONENT netdata
  2419. DESTINATION lib/systemd/system)
  2420. endif()
  2421. endif()
  2422. #
  2423. # TODO: check the following files for correct substitutions
  2424. #
  2425. configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY)
  2426. install(PROGRAMS
  2427. ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh
  2428. COMPONENT netdata
  2429. DESTINATION usr/libexec/netdata/plugins.d)
  2430. configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY)
  2431. install(PROGRAMS
  2432. ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh
  2433. COMPONENT netdata
  2434. DESTINATION usr/libexec/netdata/plugins.d)
  2435. install(PROGRAMS
  2436. src/daemon/system-info.sh
  2437. COMPONENT netdata
  2438. DESTINATION usr/libexec/netdata/plugins.d)
  2439. #
  2440. # health files
  2441. #
  2442. file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf")
  2443. install(FILES
  2444. ${HEALTH_CONF_FILES}
  2445. COMPONENT netdata
  2446. DESTINATION usr/lib/netdata/conf.d/health.d)
  2447. configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY)
  2448. install(PROGRAMS
  2449. ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh
  2450. COMPONENT netdata
  2451. DESTINATION usr/libexec/netdata/plugins.d)
  2452. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2453. install(PROGRAMS
  2454. src/health/notifications/alarm-email.sh
  2455. src/health/notifications/alarm-test.sh
  2456. COMPONENT netdata
  2457. DESTINATION usr/libexec/netdata/plugins.d)
  2458. endif()
  2459. install(FILES
  2460. src/health/notifications/health_alarm_notify.conf
  2461. src/health/notifications/health_email_recipients.conf
  2462. COMPONENT netdata
  2463. DESTINATION usr/lib/netdata/conf.d)
  2464. #
  2465. # test/ files
  2466. #
  2467. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2468. configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY)
  2469. configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY)
  2470. configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY)
  2471. configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY)
  2472. configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY)
  2473. configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY)
  2474. install(FILES
  2475. ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh
  2476. ${CMAKE_BINARY_DIR}/tests/acls/acl.sh
  2477. ${CMAKE_BINARY_DIR}/tests/urls/request.sh
  2478. ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh
  2479. ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh
  2480. ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh
  2481. DESTINATION usr/libexec/netdata/plugins.d)
  2482. endif()
  2483. #
  2484. # charts.d plugin
  2485. #
  2486. if(ENABLE_PLUGIN_CHARTS)
  2487. install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d)
  2488. configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY)
  2489. install(PROGRAMS
  2490. ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin
  2491. COMPONENT plugin-chartsd
  2492. DESTINATION usr/libexec/netdata/plugins.d)
  2493. install(PROGRAMS
  2494. src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
  2495. COMPONENT plugin-chartsd
  2496. DESTINATION usr/libexec/netdata/plugins.d)
  2497. install(FILES
  2498. src/collectors/charts.d.plugin/charts.d.conf
  2499. COMPONENT plugin-chartsd
  2500. DESTINATION usr/lib/netdata/conf.d)
  2501. install(PROGRAMS
  2502. src/collectors/charts.d.plugin/example/example.chart.sh
  2503. src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
  2504. src/collectors/charts.d.plugin/opensips/opensips.chart.sh
  2505. COMPONENT plugin-chartsd
  2506. DESTINATION usr/libexec/netdata/charts.d)
  2507. install(FILES
  2508. src/collectors/charts.d.plugin/example/example.conf
  2509. src/collectors/charts.d.plugin/libreswan/libreswan.conf
  2510. src/collectors/charts.d.plugin/opensips/opensips.conf
  2511. COMPONENT plugin-chartsd
  2512. DESTINATION usr/lib/netdata/conf.d/charts.d)
  2513. if(BUILD_FOR_PACKAGING)
  2514. install(FILES
  2515. ${PKG_FILES_PATH}/copyright
  2516. COMPONENT plugin-chartsd
  2517. DESTINATION usr/share/doc/netdata-plugin-chartsd)
  2518. endif()
  2519. endif()
  2520. # This is needed both by the TC plugin (which only gets built on Linux) and the charts plugin.
  2521. if(OS_LINUX OR ENABLE_PLUGIN_CHARTS)
  2522. install(FILES
  2523. src/collectors/charts.d.plugin/loopsleepms.sh.inc
  2524. COMPONENT netdata
  2525. DESTINATION usr/libexec/netdata/plugins.d)
  2526. endif()
  2527. #
  2528. # tc-qos-helper
  2529. #
  2530. if(OS_LINUX)
  2531. configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY)
  2532. install(PROGRAMS
  2533. ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh
  2534. COMPONENT netdata
  2535. DESTINATION usr/libexec/netdata/plugins.d)
  2536. endif()
  2537. # confs
  2538. install(FILES
  2539. src/collectors/systemd-journal.plugin/schema.d/systemd-journal%3Amonitored-directories.json
  2540. src/health/schema.d/health%3Aalert%3Aprototype.json
  2541. COMPONENT netdata
  2542. DESTINATION usr/lib/netdata/conf.d/schema.d)
  2543. #
  2544. # python.d plugin
  2545. #
  2546. if(ENABLE_PLUGIN_PYTHON)
  2547. install(DIRECTORY COMPONENT plugin-pythond DESTINATION etc/netdata/python.d)
  2548. configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY)
  2549. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin
  2550. COMPONENT plugin-pythond
  2551. DESTINATION usr/libexec/netdata/plugins.d)
  2552. install(DIRECTORY src/collectors/python.d.plugin/python_modules
  2553. COMPONENT plugin-pythond
  2554. DESTINATION usr/libexec/netdata/python.d)
  2555. install(FILES src/collectors/python.d.plugin/python.d.conf
  2556. COMPONENT plugin-pythond
  2557. DESTINATION usr/lib/netdata/conf.d)
  2558. install(FILES
  2559. src/collectors/python.d.plugin/am2320/am2320.conf
  2560. src/collectors/python.d.plugin/ceph/ceph.conf
  2561. src/collectors/python.d.plugin/go_expvar/go_expvar.conf
  2562. src/collectors/python.d.plugin/haproxy/haproxy.conf
  2563. src/collectors/python.d.plugin/openldap/openldap.conf
  2564. src/collectors/python.d.plugin/oracledb/oracledb.conf
  2565. src/collectors/python.d.plugin/pandas/pandas.conf
  2566. src/collectors/python.d.plugin/spigotmc/spigotmc.conf
  2567. src/collectors/python.d.plugin/traefik/traefik.conf
  2568. src/collectors/python.d.plugin/zscores/zscores.conf
  2569. COMPONENT plugin-pythond
  2570. DESTINATION usr/lib/netdata/conf.d/python.d)
  2571. install(FILES
  2572. src/collectors/python.d.plugin/am2320/am2320.chart.py
  2573. src/collectors/python.d.plugin/ceph/ceph.chart.py
  2574. src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
  2575. src/collectors/python.d.plugin/haproxy/haproxy.chart.py
  2576. src/collectors/python.d.plugin/openldap/openldap.chart.py
  2577. src/collectors/python.d.plugin/oracledb/oracledb.chart.py
  2578. src/collectors/python.d.plugin/pandas/pandas.chart.py
  2579. src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
  2580. src/collectors/python.d.plugin/traefik/traefik.chart.py
  2581. src/collectors/python.d.plugin/zscores/zscores.chart.py
  2582. COMPONENT plugin-pythond
  2583. DESTINATION usr/libexec/netdata/python.d)
  2584. if(BUILD_FOR_PACKAGING)
  2585. install(FILES
  2586. ${PKG_FILES_PATH}/copyright
  2587. COMPONENT plugin-pythond
  2588. DESTINATION usr/share/doc/netdata-plugin-pythond)
  2589. endif()
  2590. endif()
  2591. #
  2592. # ioping.plugin
  2593. #
  2594. configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY)
  2595. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin
  2596. COMPONENT netdata
  2597. DESTINATION usr/libexec/netdata/plugins.d)
  2598. #
  2599. # go.d.plugin
  2600. #
  2601. if(ENABLE_PLUGIN_GO)
  2602. install(DIRECTORY COMPONENT plugin-go DESTINATION etc/netdata/go.d)
  2603. install(FILES src/go/plugin/go.d/config/go.d.conf
  2604. COMPONENT plugin-go
  2605. DESTINATION usr/lib/netdata/conf.d)
  2606. install(DIRECTORY
  2607. COMPONENT plugin-go
  2608. DESTINATION usr/lib/netdata/conf.d/go.d)
  2609. file(GLOB GO_CONF_FILES src/go/plugin/go.d/config/go.d/*.conf)
  2610. install(FILES ${GO_CONF_FILES}
  2611. COMPONENT plugin-go
  2612. DESTINATION usr/lib/netdata/conf.d/go.d)
  2613. install(DIRECTORY
  2614. COMPONENT plugin-go
  2615. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2616. file(GLOB GO_SD_CONF_FILES src/go/plugin/go.d/config/go.d/sd/*.conf)
  2617. install(FILES ${GO_SD_CONF_FILES}
  2618. COMPONENT plugin-go
  2619. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2620. if(BUILD_FOR_PACKAGING)
  2621. install(FILES
  2622. ${PKG_FILES_PATH}/copyright
  2623. COMPONENT plugin-go
  2624. DESTINATION usr/share/doc/netdata-plugin-go)
  2625. endif()
  2626. endif()
  2627. #
  2628. # dashboard
  2629. #
  2630. include(src/web/gui/v1/dashboard_v1.cmake)
  2631. include(src/web/gui/v2/dashboard_v2.cmake)
  2632. include(src/web/gui/gui.cmake)
  2633. function(cat IN_FILE OUT_FILE)
  2634. file(READ ${IN_FILE} CONTENTS)
  2635. file(APPEND ${OUT_FILE} "${CONTENTS}")
  2636. endfunction()
  2637. file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "")
  2638. foreach(JS_FILE ${DASHBOARD_JS_FILES})
  2639. cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in)
  2640. endforeach()
  2641. configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in
  2642. ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY)
  2643. install(FILES
  2644. ${CMAKE_BINARY_DIR}/dashboard.js
  2645. COMPONENT netdata
  2646. DESTINATION ${WEB_DEST})
  2647. install(FILES
  2648. src/web/gui/dashboard_info_custom_example.js
  2649. src/web/gui/dashboard_info.js
  2650. src/web/gui/index.html
  2651. src/web/gui/main.css
  2652. src/web/gui/main.js
  2653. src/web/gui/registry-access.html
  2654. src/web/gui/registry-alert-redirect.html
  2655. src/web/gui/registry-hello.html
  2656. src/web/gui/switch.html
  2657. src/web/gui/ilove.html
  2658. COMPONENT netdata
  2659. DESTINATION ${WEB_DEST})
  2660. install(FILES
  2661. src/web/gui/old/index.html
  2662. COMPONENT netdata
  2663. DESTINATION ${WEB_DEST}/old)
  2664. install(FILES
  2665. src/web/gui/static/img/netdata-logomark.svg
  2666. COMPONENT netdata
  2667. DESTINATION ${WEB_DEST}/static/img)
  2668. install(FILES
  2669. src/web/gui/css/morris-0.5.1.css
  2670. src/web/gui/css/c3-0.4.18.min.css
  2671. COMPONENT netdata
  2672. DESTINATION ${WEB_DEST}/css)
  2673. install(FILES
  2674. src/web/gui/.well-known/dnt/cookies
  2675. COMPONENT netdata
  2676. DESTINATION ${WEB_DEST}/.well-known/dnt)
  2677. if(NOT OS_WINDOWS)
  2678. # v0 dashboard
  2679. install(FILES
  2680. src/web/gui/v0/index.html
  2681. COMPONENT netdata
  2682. DESTINATION ${WEB_DEST}/v0)
  2683. endif()
  2684. if(OS_WINDOWS)
  2685. # Make bash & netdata happy
  2686. install(DIRECTORY DESTINATION tmp)
  2687. # Make curl work with ssl
  2688. install(DIRECTORY /usr/ssl DESTINATION usr)
  2689. endif()
  2690. include(Packaging)