CMakeLists.txt 109 KB

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