CMakeLists.txt 109 KB

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