CMakeLists.txt 98 KB

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