CMakeLists.txt 123 KB

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