CMakeLists.txt 134 KB

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