CMakeLists.txt 97 KB

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