CMakeLists.txt 98 KB

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