buildinfo.c 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #include <stdio.h>
  3. #include "./config.h"
  4. #include "common.h"
  5. #include "buildinfo.h"
  6. typedef enum __attribute__((packed)) {
  7. BIB_PACKAGING_NETDATA_VERSION,
  8. BIB_PACKAGING_INSTALL_TYPE,
  9. BIB_PACKAGING_ARCHITECTURE,
  10. BIB_PACKAGING_DISTRO,
  11. BIB_PACKAGING_CONFIGURE_OPTIONS,
  12. BIB_DIR_USER_CONFIG,
  13. BIB_DIR_STOCK_CONFIG,
  14. BIB_DIR_CACHE,
  15. BIB_DIR_LIB,
  16. BIB_DIR_PLUGINS,
  17. BIB_DIR_WEB,
  18. BIB_DIR_LOG,
  19. BIB_DIR_LOCK,
  20. BIB_DIR_HOME,
  21. BIB_OS_KERNEL_NAME,
  22. BIB_OS_KERNEL_VERSION,
  23. BIB_OS_NAME,
  24. BIB_OS_ID,
  25. BIB_OS_ID_LIKE,
  26. BIB_OS_VERSION,
  27. BIB_OS_VERSION_ID,
  28. BIB_OS_DETECTION,
  29. BIB_HW_CPU_CORES,
  30. BIB_HW_CPU_FREQUENCY,
  31. BIB_HW_RAM_SIZE,
  32. BIB_HW_DISK_SPACE,
  33. BIB_HW_ARCHITECTURE,
  34. BIB_HW_VIRTUALIZATION,
  35. BIB_HW_VIRTUALIZATION_DETECTION,
  36. BIB_CONTAINER_NAME,
  37. BIB_CONTAINER_DETECTION,
  38. BIB_CONTAINER_ORCHESTRATOR,
  39. BIB_CONTAINER_OS_NAME,
  40. BIB_CONTAINER_OS_ID,
  41. BIB_CONTAINER_OS_ID_LIKE,
  42. BIB_CONTAINER_OS_VERSION,
  43. BIB_CONTAINER_OS_VERSION_ID,
  44. BIB_CONTAINER_OS_DETECTION,
  45. BIB_FEATURE_BUILT_FOR,
  46. BIB_FEATURE_CLOUD,
  47. BIB_FEATURE_HEALTH,
  48. BIB_FEATURE_STREAMING,
  49. BIB_FEATURE_BACKFILLING,
  50. BIB_FEATURE_REPLICATION,
  51. BIB_FEATURE_STREAMING_COMPRESSION,
  52. BIB_FEATURE_CONTEXTS,
  53. BIB_FEATURE_TIERING,
  54. BIB_FEATURE_ML,
  55. BIB_DB_DBENGINE,
  56. BIB_DB_ALLOC,
  57. BIB_DB_RAM,
  58. BIB_DB_MAP,
  59. BIB_DB_SAVE,
  60. BIB_DB_NONE,
  61. BIB_CONNECTIVITY_ACLK,
  62. BIB_CONNECTIVITY_HTTPD_STATIC,
  63. BIB_CONNECTIVITY_HTTPD_H2O,
  64. BIB_CONNECTIVITY_WEBRTC,
  65. BIB_CONNECTIVITY_NATIVE_HTTPS,
  66. BIB_CONNECTIVITY_TLS_HOST_VERIFY,
  67. BIB_LIB_LZ4,
  68. BIB_LIB_ZSTD,
  69. BIB_LIB_ZLIB,
  70. BIB_LIB_JUDY,
  71. BIB_LIB_DLIB,
  72. BIB_LIB_PROTOBUF,
  73. BIB_LIB_OPENSSL,
  74. BIB_LIB_LIBDATACHANNEL,
  75. BIB_LIB_JSONC,
  76. BIB_LIB_LIBCAP,
  77. BIB_LIB_LIBCRYPTO,
  78. BIB_LIB_LIBM,
  79. BIB_LIB_JEMALLOC,
  80. BIB_LIB_TCMALLOC,
  81. BIB_PLUGIN_APPS,
  82. BIB_PLUGIN_LINUX_CGROUPS,
  83. BIB_PLUGIN_LINUX_CGROUP_NETWORK,
  84. BIB_PLUGIN_LINUX_PROC,
  85. BIB_PLUGIN_LINUX_TC,
  86. BIB_PLUGIN_LINUX_DISKSPACE,
  87. BIB_PLUGIN_FREEBSD,
  88. BIB_PLUGIN_MACOS,
  89. BIB_PLUGIN_STATSD,
  90. BIB_PLUGIN_TIMEX,
  91. BIB_PLUGIN_IDLEJITTER,
  92. BIB_PLUGIN_BASH,
  93. BIB_PLUGIN_DEBUGFS,
  94. BIB_PLUGIN_CUPS,
  95. BIB_PLUGIN_EBPF,
  96. BIB_PLUGIN_FREEIPMI,
  97. BIB_PLUGIN_NFACCT,
  98. BIB_PLUGIN_PERF,
  99. BIB_PLUGIN_SLABINFO,
  100. BIB_PLUGIN_XEN,
  101. BIB_PLUGIN_XEN_VBD_ERROR,
  102. BIB_PLUGIN_LOGS_MANAGEMENT,
  103. BIB_EXPORT_AWS_KINESIS,
  104. BIB_EXPORT_GCP_PUBSUB,
  105. BIB_EXPORT_MONGOC,
  106. BIB_EXPORT_PROMETHEUS_EXPORTER,
  107. BIB_EXPORT_PROMETHEUS_REMOTE_WRITE,
  108. BIB_EXPORT_GRAPHITE,
  109. BIB_EXPORT_GRAPHITE_HTTP,
  110. BIB_EXPORT_JSON,
  111. BIB_EXPORT_JSON_HTTP,
  112. BIB_EXPORT_OPENTSDB,
  113. BIB_EXPORT_OPENTSDB_HTTP,
  114. BIB_EXPORT_ALLMETRICS,
  115. BIB_EXPORT_SHELL,
  116. BIB_DEVEL_TRACE_ALLOCATIONS,
  117. BIB_DEVELOPER_MODE,
  118. // leave this last
  119. BIB_TERMINATOR,
  120. } BUILD_INFO_SLOT;
  121. typedef enum __attribute__((packed)) {
  122. BIC_PACKAGING,
  123. BIC_DIRECTORIES,
  124. BIC_OPERATING_SYSTEM,
  125. BIC_HARDWARE,
  126. BIC_CONTAINER,
  127. BIC_FEATURE,
  128. BIC_DATABASE,
  129. BIC_CONNECTIVITY,
  130. BIC_LIBS,
  131. BIC_PLUGINS,
  132. BIC_EXPORTERS,
  133. BIC_DEBUG_DEVEL
  134. } BUILD_INFO_CATEGORY;
  135. typedef enum __attribute__((packed)) {
  136. BIT_BOOLEAN,
  137. BIT_STRING,
  138. } BUILD_INFO_TYPE;
  139. static struct {
  140. BUILD_INFO_CATEGORY category;
  141. BUILD_INFO_TYPE type;
  142. const char *analytics;
  143. const char *print;
  144. const char *json;
  145. bool status;
  146. const char *value;
  147. } BUILD_INFO[] = {
  148. [BIB_PACKAGING_NETDATA_VERSION] = {
  149. .category = BIC_PACKAGING,
  150. .type = BIT_STRING,
  151. .analytics = NULL,
  152. .print = "Netdata Version",
  153. .json = "version",
  154. .value = "unknown",
  155. },
  156. [BIB_PACKAGING_INSTALL_TYPE] = {
  157. .category = BIC_PACKAGING,
  158. .type = BIT_STRING,
  159. .analytics = NULL,
  160. .print = "Installation Type",
  161. .json = "type",
  162. .value = "unknown",
  163. },
  164. [BIB_PACKAGING_ARCHITECTURE] = {
  165. .category = BIC_PACKAGING,
  166. .type = BIT_STRING,
  167. .analytics = NULL,
  168. .print = "Package Architecture",
  169. .json = "arch",
  170. .value = "unknown",
  171. },
  172. [BIB_PACKAGING_DISTRO] = {
  173. .category = BIC_PACKAGING,
  174. .type = BIT_STRING,
  175. .analytics = NULL,
  176. .print = "Package Distro",
  177. .json = "distro",
  178. .value = "unknown",
  179. },
  180. [BIB_PACKAGING_CONFIGURE_OPTIONS] = {
  181. .category = BIC_PACKAGING,
  182. .type = BIT_STRING,
  183. .analytics = NULL,
  184. .print = "Configure Options",
  185. .json = "configure",
  186. .value = "unknown",
  187. },
  188. [BIB_DIR_USER_CONFIG] = {
  189. .category = BIC_DIRECTORIES,
  190. .type = BIT_STRING,
  191. .analytics = NULL,
  192. .print = "User Configurations",
  193. .json = "user_config",
  194. .value = CONFIG_DIR,
  195. },
  196. [BIB_DIR_STOCK_CONFIG] = {
  197. .category = BIC_DIRECTORIES,
  198. .type = BIT_STRING,
  199. .analytics = NULL,
  200. .print = "Stock Configurations",
  201. .json = "stock_config",
  202. .value = LIBCONFIG_DIR,
  203. },
  204. [BIB_DIR_CACHE] = {
  205. .category = BIC_DIRECTORIES,
  206. .type = BIT_STRING,
  207. .analytics = NULL,
  208. .print = "Ephemeral Databases (metrics data, metadata)",
  209. .json = "ephemeral_db",
  210. .value = CACHE_DIR,
  211. },
  212. [BIB_DIR_LIB] = {
  213. .category = BIC_DIRECTORIES,
  214. .type = BIT_STRING,
  215. .analytics = NULL,
  216. .print = "Permanent Databases",
  217. .json = "permanent_db",
  218. .value = VARLIB_DIR,
  219. },
  220. [BIB_DIR_PLUGINS] = {
  221. .category = BIC_DIRECTORIES,
  222. .type = BIT_STRING,
  223. .analytics = NULL,
  224. .print = "Plugins",
  225. .json = "plugins",
  226. .value = PLUGINS_DIR,
  227. },
  228. [BIB_DIR_WEB] = {
  229. .category = BIC_DIRECTORIES,
  230. .type = BIT_STRING,
  231. .analytics = NULL,
  232. .print = "Static Web Files",
  233. .json = "web",
  234. .value = WEB_DIR,
  235. },
  236. [BIB_DIR_LOG] = {
  237. .category = BIC_DIRECTORIES,
  238. .type = BIT_STRING,
  239. .analytics = NULL,
  240. .print = "Log Files",
  241. .json = "logs",
  242. .value = LOG_DIR,
  243. },
  244. [BIB_DIR_LOCK] = {
  245. .category = BIC_DIRECTORIES,
  246. .type = BIT_STRING,
  247. .analytics = NULL,
  248. .print = "Lock Files",
  249. .json = "locks",
  250. .value = VARLIB_DIR "/lock",
  251. },
  252. [BIB_DIR_HOME] = {
  253. .category = BIC_DIRECTORIES,
  254. .type = BIT_STRING,
  255. .analytics = NULL,
  256. .print = "Home",
  257. .json = "home",
  258. .value = VARLIB_DIR,
  259. },
  260. [BIB_OS_KERNEL_NAME] = {
  261. .category = BIC_OPERATING_SYSTEM,
  262. .type = BIT_STRING,
  263. .analytics = NULL,
  264. .print = "Kernel",
  265. .json = "kernel",
  266. .value = "unknown",
  267. },
  268. [BIB_OS_KERNEL_VERSION] = {
  269. .category = BIC_OPERATING_SYSTEM,
  270. .type = BIT_STRING,
  271. .analytics = NULL,
  272. .print = "Kernel Version",
  273. .json = "kernel_version",
  274. .value = "unknown",
  275. },
  276. [BIB_OS_NAME] = {
  277. .category = BIC_OPERATING_SYSTEM,
  278. .type = BIT_STRING,
  279. .analytics = NULL,
  280. .print = "Operating System",
  281. .json = "os",
  282. .value = "unknown",
  283. },
  284. [BIB_OS_ID] = {
  285. .category = BIC_OPERATING_SYSTEM,
  286. .type = BIT_STRING,
  287. .analytics = NULL,
  288. .print = "Operating System ID",
  289. .json = "id",
  290. .value = "unknown",
  291. },
  292. [BIB_OS_ID_LIKE] = {
  293. .category = BIC_OPERATING_SYSTEM,
  294. .type = BIT_STRING,
  295. .analytics = NULL,
  296. .print = "Operating System ID Like",
  297. .json = "id_like",
  298. .value = "unknown",
  299. },
  300. [BIB_OS_VERSION] = {
  301. .category = BIC_OPERATING_SYSTEM,
  302. .type = BIT_STRING,
  303. .analytics = NULL,
  304. .print = "Operating System Version",
  305. .json = "version",
  306. .value = "unknown",
  307. },
  308. [BIB_OS_VERSION_ID] = {
  309. .category = BIC_OPERATING_SYSTEM,
  310. .type = BIT_STRING,
  311. .analytics = NULL,
  312. .print = "Operating System Version ID",
  313. .json = "version_id",
  314. .value = "unknown",
  315. },
  316. [BIB_OS_DETECTION] = {
  317. .category = BIC_OPERATING_SYSTEM,
  318. .type = BIT_STRING,
  319. .analytics = NULL,
  320. .print = "Detection",
  321. .json = "detection",
  322. .value = "unknown",
  323. },
  324. [BIB_HW_CPU_CORES] = {
  325. .category = BIC_HARDWARE,
  326. .type = BIT_STRING,
  327. .analytics = NULL,
  328. .print = "CPU Cores",
  329. .json = "cpu_cores",
  330. .value = "unknown",
  331. },
  332. [BIB_HW_CPU_FREQUENCY] = {
  333. .category = BIC_HARDWARE,
  334. .type = BIT_STRING,
  335. .analytics = NULL,
  336. .print = "CPU Frequency",
  337. .json = "cpu_frequency",
  338. .value = "unknown",
  339. },
  340. [BIB_HW_ARCHITECTURE] = {
  341. .category = BIC_HARDWARE,
  342. .type = BIT_STRING,
  343. .analytics = NULL,
  344. .print = "CPU Architecture",
  345. .json = "cpu_architecture",
  346. .value = "unknown",
  347. },
  348. [BIB_HW_RAM_SIZE] = {
  349. .category = BIC_HARDWARE,
  350. .type = BIT_STRING,
  351. .analytics = NULL,
  352. .print = "RAM Bytes",
  353. .json = "ram",
  354. .value = "unknown",
  355. },
  356. [BIB_HW_DISK_SPACE] = {
  357. .category = BIC_HARDWARE,
  358. .type = BIT_STRING,
  359. .analytics = NULL,
  360. .print = "Disk Capacity",
  361. .json = "disk",
  362. .value = "unknown",
  363. },
  364. [BIB_HW_VIRTUALIZATION] = {
  365. .category = BIC_HARDWARE,
  366. .type = BIT_STRING,
  367. .analytics = NULL,
  368. .print = "Virtualization Technology",
  369. .json = "virtualization",
  370. .value = "unknown",
  371. },
  372. [BIB_HW_VIRTUALIZATION_DETECTION] = {
  373. .category = BIC_HARDWARE,
  374. .type = BIT_STRING,
  375. .analytics = NULL,
  376. .print = "Virtualization Detection",
  377. .json = "virtualization_detection",
  378. .value = "unknown",
  379. },
  380. [BIB_CONTAINER_NAME] = {
  381. .category = BIC_CONTAINER,
  382. .type = BIT_STRING,
  383. .analytics = NULL,
  384. .print = "Container",
  385. .json = "container",
  386. .value = "unknown",
  387. },
  388. [BIB_CONTAINER_DETECTION] = {
  389. .category = BIC_CONTAINER,
  390. .type = BIT_STRING,
  391. .analytics = NULL,
  392. .print = "Container Detection",
  393. .json = "container_detection",
  394. .value = "unknown",
  395. },
  396. [BIB_CONTAINER_ORCHESTRATOR] = {
  397. .category = BIC_CONTAINER,
  398. .type = BIT_STRING,
  399. .analytics = NULL,
  400. .print = "Container Orchestrator",
  401. .json = "orchestrator",
  402. .value = "unknown",
  403. },
  404. [BIB_CONTAINER_OS_NAME] = {
  405. .category = BIC_CONTAINER,
  406. .type = BIT_STRING,
  407. .analytics = NULL,
  408. .print = "Container Operating System",
  409. .json = "os",
  410. .value = "unknown",
  411. },
  412. [BIB_CONTAINER_OS_ID] = {
  413. .category = BIC_CONTAINER,
  414. .type = BIT_STRING,
  415. .analytics = NULL,
  416. .print = "Container Operating System ID",
  417. .json = "os_id",
  418. .value = "unknown",
  419. },
  420. [BIB_CONTAINER_OS_ID_LIKE] = {
  421. .category = BIC_CONTAINER,
  422. .type = BIT_STRING,
  423. .analytics = NULL,
  424. .print = "Container Operating System ID Like",
  425. .json = "os_id_like",
  426. .value = "unknown",
  427. },
  428. [BIB_CONTAINER_OS_VERSION] = {
  429. .category = BIC_CONTAINER,
  430. .type = BIT_STRING,
  431. .analytics = NULL,
  432. .print = "Container Operating System Version",
  433. .json = "version",
  434. .value = "unknown",
  435. },
  436. [BIB_CONTAINER_OS_VERSION_ID] = {
  437. .category = BIC_CONTAINER,
  438. .type = BIT_STRING,
  439. .analytics = NULL,
  440. .print = "Container Operating System Version ID",
  441. .json = "version_id",
  442. .value = "unknown",
  443. },
  444. [BIB_CONTAINER_OS_DETECTION] = {
  445. .category = BIC_CONTAINER,
  446. .type = BIT_STRING,
  447. .analytics = NULL,
  448. .print = "Container Operating System Detection",
  449. .json = "detection",
  450. .value = "unknown",
  451. },
  452. [BIB_FEATURE_BUILT_FOR] = {
  453. .category = BIC_FEATURE,
  454. .type = BIT_STRING,
  455. .analytics = NULL,
  456. .print = "Built For",
  457. .json = "built-for",
  458. .value = "unknown",
  459. },
  460. [BIB_FEATURE_CLOUD] = {
  461. .category = BIC_FEATURE,
  462. .type = BIT_BOOLEAN,
  463. .analytics = "Netdata Cloud",
  464. .print = "Netdata Cloud",
  465. .json = "cloud",
  466. .value = NULL,
  467. },
  468. [BIB_FEATURE_HEALTH] = {
  469. .category = BIC_FEATURE,
  470. .type = BIT_BOOLEAN,
  471. .analytics = NULL,
  472. .print = "Health (trigger alerts and send notifications)",
  473. .json = "health",
  474. .value = NULL,
  475. },
  476. [BIB_FEATURE_STREAMING] = {
  477. .category = BIC_FEATURE,
  478. .type = BIT_BOOLEAN,
  479. .analytics = NULL,
  480. .print = "Streaming (stream metrics to parent Netdata servers)",
  481. .json = "streaming",
  482. .value = NULL,
  483. },
  484. [BIB_FEATURE_BACKFILLING] = {
  485. .category = BIC_FEATURE,
  486. .type = BIT_BOOLEAN,
  487. .analytics = NULL,
  488. .print = "Back-filling (of higher database tiers)",
  489. .json = "back-filling",
  490. .value = NULL,
  491. },
  492. [BIB_FEATURE_REPLICATION] = {
  493. .category = BIC_FEATURE,
  494. .type = BIT_BOOLEAN,
  495. .analytics = NULL,
  496. .print = "Replication (fill the gaps of parent Netdata servers)",
  497. .json = "replication",
  498. .value = NULL,
  499. },
  500. [BIB_FEATURE_STREAMING_COMPRESSION] = {
  501. .category = BIC_FEATURE,
  502. .type = BIT_BOOLEAN,
  503. .analytics = "Stream Compression",
  504. .print = "Streaming and Replication Compression",
  505. .json = "stream-compression",
  506. .value = NULL,
  507. },
  508. [BIB_FEATURE_CONTEXTS] = {
  509. .category = BIC_FEATURE,
  510. .type = BIT_BOOLEAN,
  511. .analytics = NULL,
  512. .print = "Contexts (index all active and archived metrics)",
  513. .json = "contexts",
  514. .value = NULL,
  515. },
  516. [BIB_FEATURE_TIERING] = {
  517. .category = BIC_FEATURE,
  518. .type = BIT_BOOLEAN,
  519. .analytics = NULL,
  520. .print = "Tiering (multiple dbs with different metrics resolution)",
  521. .json = "tiering",
  522. .value = TOSTRING(RRD_STORAGE_TIERS),
  523. },
  524. [BIB_FEATURE_ML] = {
  525. .category = BIC_FEATURE,
  526. .type = BIT_BOOLEAN,
  527. .analytics = "Machine Learning",
  528. .print = "Machine Learning",
  529. .json = "ml",
  530. .value = NULL,
  531. },
  532. [BIB_DB_DBENGINE] = {
  533. .category = BIC_DATABASE,
  534. .type = BIT_BOOLEAN,
  535. .analytics = "dbengine",
  536. .print = "dbengine",
  537. .json = "dbengine",
  538. .value = NULL,
  539. },
  540. [BIB_DB_ALLOC] = {
  541. .category = BIC_DATABASE,
  542. .type = BIT_BOOLEAN,
  543. .analytics = NULL,
  544. .print = "alloc",
  545. .json = "alloc",
  546. .value = NULL,
  547. },
  548. [BIB_DB_RAM] = {
  549. .category = BIC_DATABASE,
  550. .type = BIT_BOOLEAN,
  551. .analytics = NULL,
  552. .print = "ram",
  553. .json = "ram",
  554. .value = NULL,
  555. },
  556. [BIB_DB_MAP] = {
  557. .category = BIC_DATABASE,
  558. .type = BIT_BOOLEAN,
  559. .analytics = NULL,
  560. .print = "map",
  561. .json = "map",
  562. .value = NULL,
  563. },
  564. [BIB_DB_SAVE] = {
  565. .category = BIC_DATABASE,
  566. .type = BIT_BOOLEAN,
  567. .analytics = NULL,
  568. .print = "save",
  569. .json = "save",
  570. .value = NULL,
  571. },
  572. [BIB_DB_NONE] = {
  573. .category = BIC_DATABASE,
  574. .type = BIT_BOOLEAN,
  575. .analytics = NULL,
  576. .print = "none",
  577. .json = "none",
  578. .value = NULL,
  579. },
  580. [BIB_CONNECTIVITY_ACLK] = {
  581. .category = BIC_CONNECTIVITY,
  582. .type = BIT_BOOLEAN,
  583. .analytics = NULL,
  584. .print = "ACLK (Agent-Cloud Link: MQTT over WebSockets over TLS)",
  585. .json = "aclk",
  586. .value = NULL,
  587. },
  588. [BIB_CONNECTIVITY_HTTPD_STATIC] = {
  589. .category = BIC_CONNECTIVITY,
  590. .type = BIT_BOOLEAN,
  591. .analytics = NULL,
  592. .print = "static (Netdata internal web server)",
  593. .json = "static",
  594. .value = NULL,
  595. },
  596. [BIB_CONNECTIVITY_HTTPD_H2O] = {
  597. .category = BIC_CONNECTIVITY,
  598. .type = BIT_BOOLEAN,
  599. .analytics = NULL,
  600. .print = "h2o (web server)",
  601. .json = "h2o",
  602. .value = NULL,
  603. },
  604. [BIB_CONNECTIVITY_WEBRTC] = {
  605. .category = BIC_CONNECTIVITY,
  606. .type = BIT_BOOLEAN,
  607. .analytics = NULL,
  608. .print = "WebRTC (experimental)",
  609. .json = "webrtc",
  610. .value = NULL,
  611. },
  612. [BIB_CONNECTIVITY_NATIVE_HTTPS] = {
  613. .category = BIC_CONNECTIVITY,
  614. .type = BIT_BOOLEAN,
  615. .analytics = "Native HTTPS",
  616. .print = "Native HTTPS (TLS Support)",
  617. .json = "native-https",
  618. .value = NULL,
  619. },
  620. [BIB_CONNECTIVITY_TLS_HOST_VERIFY] = {
  621. .category = BIC_CONNECTIVITY,
  622. .type = BIT_BOOLEAN,
  623. .analytics = "TLS Host Verification",
  624. .print = "TLS Host Verification",
  625. .json = "tls-host-verify",
  626. .value = NULL,
  627. },
  628. [BIB_LIB_LZ4] = {
  629. .category = BIC_LIBS,
  630. .type = BIT_BOOLEAN,
  631. .analytics = NULL,
  632. .print = "LZ4 (extremely fast lossless compression algorithm)",
  633. .json = "lz4",
  634. .value = NULL,
  635. },
  636. [BIB_LIB_ZSTD] = {
  637. .category = BIC_LIBS,
  638. .type = BIT_BOOLEAN,
  639. .analytics = NULL,
  640. .print = "ZSTD (fast, lossless compression algorithm)",
  641. .json = "zstd",
  642. .value = NULL,
  643. },
  644. [BIB_LIB_ZLIB] = {
  645. .category = BIC_LIBS,
  646. .type = BIT_BOOLEAN,
  647. .analytics = "zlib",
  648. .print = "zlib (lossless data-compression library)",
  649. .json = "zlib",
  650. .value = NULL,
  651. },
  652. [BIB_LIB_JUDY] = {
  653. .category = BIC_LIBS,
  654. .type = BIT_BOOLEAN,
  655. .analytics = NULL,
  656. .print = "Judy (high-performance dynamic arrays and hashtables)",
  657. .json = "judy",
  658. .status = true,
  659. .value = "bundled",
  660. },
  661. [BIB_LIB_DLIB] = {
  662. .category = BIC_LIBS,
  663. .type = BIT_BOOLEAN,
  664. .analytics = NULL,
  665. .print = "dlib (robust machine learning toolkit)",
  666. .json = "dlib",
  667. .value = NULL,
  668. },
  669. [BIB_LIB_PROTOBUF] = {
  670. .category = BIC_LIBS,
  671. .type = BIT_BOOLEAN,
  672. .analytics = "protobuf",
  673. .print = "protobuf (platform-neutral data serialization protocol)",
  674. .json = "protobuf",
  675. .value = NULL,
  676. },
  677. [BIB_LIB_OPENSSL] = {
  678. .category = BIC_LIBS,
  679. .type = BIT_BOOLEAN,
  680. .analytics = NULL,
  681. .print = "OpenSSL (cryptography)",
  682. .json = "openssl",
  683. .value = NULL,
  684. },
  685. [BIB_LIB_LIBDATACHANNEL] = {
  686. .category = BIC_LIBS,
  687. .type = BIT_BOOLEAN,
  688. .analytics = NULL,
  689. .print = "libdatachannel (stand-alone WebRTC data channels)",
  690. .json = "libdatachannel",
  691. .value = NULL,
  692. },
  693. [BIB_LIB_JSONC] = {
  694. .category = BIC_LIBS,
  695. .type = BIT_BOOLEAN,
  696. .analytics = "JSON-C",
  697. .print = "JSON-C (lightweight JSON manipulation)",
  698. .json = "jsonc",
  699. .value = NULL,
  700. },
  701. [BIB_LIB_LIBCAP] = {
  702. .category = BIC_LIBS,
  703. .type = BIT_BOOLEAN,
  704. .analytics = "libcap",
  705. .print = "libcap (Linux capabilities system operations)",
  706. .json = "libcap",
  707. .value = NULL,
  708. },
  709. [BIB_LIB_LIBCRYPTO] = {
  710. .category = BIC_LIBS,
  711. .type = BIT_BOOLEAN,
  712. .analytics = "libcrypto",
  713. .print = "libcrypto (cryptographic functions)",
  714. .json = "libcrypto",
  715. .value = NULL,
  716. },
  717. [BIB_LIB_LIBM] = {
  718. .category = BIC_LIBS,
  719. .type = BIT_BOOLEAN,
  720. .analytics = "libm",
  721. .print = "libm (mathematical functions)",
  722. .json = "libm",
  723. .value = NULL,
  724. },
  725. [BIB_LIB_JEMALLOC] = {
  726. .category = BIC_LIBS,
  727. .type = BIT_BOOLEAN,
  728. .analytics = "jemalloc",
  729. .print = "jemalloc",
  730. .json = "jemalloc",
  731. .value = NULL,
  732. },
  733. [BIB_LIB_TCMALLOC] = {
  734. .category = BIC_LIBS,
  735. .type = BIT_BOOLEAN,
  736. .analytics = "tcmalloc",
  737. .print = "TCMalloc",
  738. .json = "tcmalloc",
  739. .value = NULL,
  740. },
  741. [BIB_PLUGIN_APPS] = {
  742. .category = BIC_PLUGINS,
  743. .type = BIT_BOOLEAN,
  744. .analytics = "apps",
  745. .print = "apps (monitor processes)",
  746. .json = "apps",
  747. .value = NULL,
  748. },
  749. [BIB_PLUGIN_LINUX_CGROUPS] = {
  750. .category = BIC_PLUGINS,
  751. .type = BIT_BOOLEAN,
  752. .analytics = NULL,
  753. .print = "cgroups (monitor containers and VMs)",
  754. .json = "cgroups",
  755. .value = NULL,
  756. },
  757. [BIB_PLUGIN_LINUX_CGROUP_NETWORK] = {
  758. .category = BIC_PLUGINS,
  759. .type = BIT_BOOLEAN,
  760. .analytics = "cgroup Network Tracking",
  761. .print = "cgroup-network (associate interfaces to CGROUPS)",
  762. .json = "cgroup-network",
  763. .value = NULL,
  764. },
  765. [BIB_PLUGIN_LINUX_PROC] = {
  766. .category = BIC_PLUGINS,
  767. .type = BIT_BOOLEAN,
  768. .analytics = NULL,
  769. .print = "proc (monitor Linux systems)",
  770. .json = "proc",
  771. .value = NULL,
  772. },
  773. [BIB_PLUGIN_LINUX_TC] = {
  774. .category = BIC_PLUGINS,
  775. .type = BIT_BOOLEAN,
  776. .analytics = NULL,
  777. .print = "tc (monitor Linux network QoS)",
  778. .json = "tc",
  779. .value = NULL,
  780. },
  781. [BIB_PLUGIN_LINUX_DISKSPACE] = {
  782. .category = BIC_PLUGINS,
  783. .type = BIT_BOOLEAN,
  784. .analytics = NULL,
  785. .print = "diskspace (monitor Linux mount points)",
  786. .json = "diskspace",
  787. .value = NULL,
  788. },
  789. [BIB_PLUGIN_FREEBSD] = {
  790. .category = BIC_PLUGINS,
  791. .type = BIT_BOOLEAN,
  792. .analytics = NULL,
  793. .print = "freebsd (monitor FreeBSD systems)",
  794. .json = "freebsd",
  795. .value = NULL,
  796. },
  797. [BIB_PLUGIN_MACOS] = {
  798. .category = BIC_PLUGINS,
  799. .type = BIT_BOOLEAN,
  800. .analytics = NULL,
  801. .print = "macos (monitor MacOS systems)",
  802. .json = "macos",
  803. .value = NULL,
  804. },
  805. [BIB_PLUGIN_STATSD] = {
  806. .category = BIC_PLUGINS,
  807. .type = BIT_BOOLEAN,
  808. .analytics = NULL,
  809. .print = "statsd (collect custom application metrics)",
  810. .json = "statsd",
  811. .value = NULL,
  812. },
  813. [BIB_PLUGIN_TIMEX] = {
  814. .category = BIC_PLUGINS,
  815. .type = BIT_BOOLEAN,
  816. .analytics = NULL,
  817. .print = "timex (check system clock synchronization)",
  818. .json = "timex",
  819. .value = NULL,
  820. },
  821. [BIB_PLUGIN_IDLEJITTER] = {
  822. .category = BIC_PLUGINS,
  823. .type = BIT_BOOLEAN,
  824. .analytics = NULL,
  825. .print = "idlejitter (check system latency and jitter)",
  826. .json = "idlejitter",
  827. .value = NULL,
  828. },
  829. [BIB_PLUGIN_BASH] = {
  830. .category = BIC_PLUGINS,
  831. .type = BIT_BOOLEAN,
  832. .analytics = NULL,
  833. .print = "bash (support shell data collection jobs - charts.d)",
  834. .json = "charts.d",
  835. .value = NULL,
  836. },
  837. [BIB_PLUGIN_DEBUGFS] = {
  838. .category = BIC_PLUGINS,
  839. .type = BIT_BOOLEAN,
  840. .analytics = "debugfs",
  841. .print = "debugfs (kernel debugging metrics)",
  842. .json = "debugfs",
  843. .value = NULL,
  844. },
  845. [BIB_PLUGIN_CUPS] = {
  846. .category = BIC_PLUGINS,
  847. .type = BIT_BOOLEAN,
  848. .analytics = "CUPS",
  849. .print = "cups (monitor printers and print jobs)",
  850. .json = "cups",
  851. .value = NULL,
  852. },
  853. [BIB_PLUGIN_EBPF] = {
  854. .category = BIC_PLUGINS,
  855. .type = BIT_BOOLEAN,
  856. .analytics = "EBPF",
  857. .print = "ebpf (monitor system calls)",
  858. .json = "ebpf",
  859. .value = NULL,
  860. },
  861. [BIB_PLUGIN_FREEIPMI] = {
  862. .category = BIC_PLUGINS,
  863. .type = BIT_BOOLEAN,
  864. .analytics = "IPMI",
  865. .print = "freeipmi (monitor enterprise server H/W)",
  866. .json = "freeipmi",
  867. .value = NULL,
  868. },
  869. [BIB_PLUGIN_NFACCT] = {
  870. .category = BIC_PLUGINS,
  871. .type = BIT_BOOLEAN,
  872. .analytics = "NFACCT",
  873. .print = "nfacct (gather netfilter accounting)",
  874. .json = "nfacct",
  875. .value = NULL,
  876. },
  877. [BIB_PLUGIN_PERF] = {
  878. .category = BIC_PLUGINS,
  879. .type = BIT_BOOLEAN,
  880. .analytics = "perf",
  881. .print = "perf (collect kernel performance events)",
  882. .json = "perf",
  883. .value = NULL,
  884. },
  885. [BIB_PLUGIN_SLABINFO] = {
  886. .category = BIC_PLUGINS,
  887. .type = BIT_BOOLEAN,
  888. .analytics = "slabinfo",
  889. .print = "slabinfo (monitor kernel object caching)",
  890. .json = "slabinfo",
  891. .value = NULL,
  892. },
  893. [BIB_PLUGIN_XEN] = {
  894. .category = BIC_PLUGINS,
  895. .type = BIT_BOOLEAN,
  896. .analytics = "Xen",
  897. .print = "Xen",
  898. .json = "xen",
  899. .value = NULL,
  900. },
  901. [BIB_PLUGIN_XEN_VBD_ERROR] = {
  902. .category = BIC_PLUGINS,
  903. .type = BIT_BOOLEAN,
  904. .analytics = "Xen VBD Error Tracking",
  905. .print = "Xen VBD Error Tracking",
  906. .json = "xen-vbd-error",
  907. .value = NULL,
  908. },
  909. [BIB_PLUGIN_LOGS_MANAGEMENT] = {
  910. .category = BIC_PLUGINS,
  911. .type = BIT_BOOLEAN,
  912. .analytics = "Logs Management",
  913. .print = "Logs Management",
  914. .json = "logs-management",
  915. .value = NULL,
  916. },
  917. [BIB_EXPORT_MONGOC] = {
  918. .category = BIC_EXPORTERS,
  919. .type = BIT_BOOLEAN,
  920. .analytics = "MongoDB",
  921. .print = "MongoDB",
  922. .json = "mongodb",
  923. .value = NULL,
  924. },
  925. [BIB_EXPORT_GRAPHITE] = {
  926. .category = BIC_EXPORTERS,
  927. .type = BIT_BOOLEAN,
  928. .analytics = NULL,
  929. .print = "Graphite",
  930. .json = "graphite",
  931. .value = NULL,
  932. },
  933. [BIB_EXPORT_GRAPHITE_HTTP] = {
  934. .category = BIC_EXPORTERS,
  935. .type = BIT_BOOLEAN,
  936. .analytics = NULL,
  937. .print = "Graphite HTTP / HTTPS",
  938. .json = "graphite:http",
  939. .value = NULL,
  940. },
  941. [BIB_EXPORT_JSON] = {
  942. .category = BIC_EXPORTERS,
  943. .type = BIT_BOOLEAN,
  944. .analytics = NULL,
  945. .print = "JSON",
  946. .json = "json",
  947. .value = NULL,
  948. },
  949. [BIB_EXPORT_JSON_HTTP] = {
  950. .category = BIC_EXPORTERS,
  951. .type = BIT_BOOLEAN,
  952. .analytics = NULL,
  953. .print = "JSON HTTP / HTTPS",
  954. .json = "json:http",
  955. .value = NULL,
  956. },
  957. [BIB_EXPORT_OPENTSDB] = {
  958. .category = BIC_EXPORTERS,
  959. .type = BIT_BOOLEAN,
  960. .analytics = NULL,
  961. .print = "OpenTSDB",
  962. .json = "opentsdb",
  963. .value = NULL,
  964. },
  965. [BIB_EXPORT_OPENTSDB_HTTP] = {
  966. .category = BIC_EXPORTERS,
  967. .type = BIT_BOOLEAN,
  968. .analytics = NULL,
  969. .print = "OpenTSDB HTTP / HTTPS",
  970. .json = "opentsdb:http",
  971. .value = NULL,
  972. },
  973. [BIB_EXPORT_ALLMETRICS] = {
  974. .category = BIC_EXPORTERS,
  975. .analytics = NULL,
  976. .type = BIT_BOOLEAN,
  977. .print = "All Metrics API",
  978. .json = "allmetrics",
  979. .value = NULL,
  980. },
  981. [BIB_EXPORT_SHELL] = {
  982. .category = BIC_EXPORTERS,
  983. .type = BIT_BOOLEAN,
  984. .analytics = NULL,
  985. .print = "Shell (use metrics in shell scripts)",
  986. .json = "shell",
  987. .value = NULL,
  988. },
  989. [BIB_EXPORT_PROMETHEUS_EXPORTER] = {
  990. .category = BIC_EXPORTERS,
  991. .type = BIT_BOOLEAN,
  992. .analytics = NULL,
  993. .print = "Prometheus (OpenMetrics) Exporter",
  994. .json = "openmetrics",
  995. .value = NULL,
  996. },
  997. [BIB_EXPORT_PROMETHEUS_REMOTE_WRITE] = {
  998. .category = BIC_EXPORTERS,
  999. .type = BIT_BOOLEAN,
  1000. .analytics = "Prometheus Remote Write",
  1001. .print = "Prometheus Remote Write",
  1002. .json = "prom-remote-write",
  1003. .value = NULL,
  1004. },
  1005. [BIB_EXPORT_AWS_KINESIS] = {
  1006. .category = BIC_EXPORTERS,
  1007. .type = BIT_BOOLEAN,
  1008. .analytics = "AWS Kinesis",
  1009. .print = "AWS Kinesis",
  1010. .json = "kinesis",
  1011. .value = NULL,
  1012. },
  1013. [BIB_EXPORT_GCP_PUBSUB] = {
  1014. .category = BIC_EXPORTERS,
  1015. .type = BIT_BOOLEAN,
  1016. .analytics = "GCP PubSub",
  1017. .print = "GCP PubSub",
  1018. .json = "pubsub",
  1019. .value = NULL,
  1020. },
  1021. [BIB_DEVEL_TRACE_ALLOCATIONS] = {
  1022. .category = BIC_DEBUG_DEVEL,
  1023. .type = BIT_BOOLEAN,
  1024. .analytics = "DebugTraceAlloc",
  1025. .print = "Trace All Netdata Allocations (with charts)",
  1026. .json = "trace-allocations",
  1027. .value = NULL,
  1028. },
  1029. [BIB_DEVELOPER_MODE] = {
  1030. .category = BIC_DEBUG_DEVEL,
  1031. .type = BIT_BOOLEAN,
  1032. .analytics = NULL,
  1033. .print = "Developer Mode (more runtime checks, slower)",
  1034. .json = "dev-mode",
  1035. .value = NULL,
  1036. },
  1037. // leave this last
  1038. [BIB_TERMINATOR] = {
  1039. .category = 0,
  1040. .type = 0,
  1041. .analytics = NULL,
  1042. .print = NULL,
  1043. .json = NULL,
  1044. .value = NULL,
  1045. },
  1046. };
  1047. static void build_info_set_value(BUILD_INFO_SLOT slot, const char *value) {
  1048. BUILD_INFO[slot].value = value;
  1049. }
  1050. static void build_info_append_value(BUILD_INFO_SLOT slot, const char *value) {
  1051. size_t size = BUILD_INFO[slot].value ? strlen(BUILD_INFO[slot].value) + 1 : 0;
  1052. size += strlen(value);
  1053. char buf[size + 1];
  1054. if(BUILD_INFO[slot].value) {
  1055. strcpy(buf, BUILD_INFO[slot].value);
  1056. strcat(buf, " ");
  1057. strcat(buf, value);
  1058. }
  1059. else
  1060. strcpy(buf, value);
  1061. freez((void *)BUILD_INFO[slot].value);
  1062. BUILD_INFO[slot].value = strdupz(buf);
  1063. }
  1064. static void build_info_set_value_strdupz(BUILD_INFO_SLOT slot, const char *value) {
  1065. if(!value) value = "";
  1066. build_info_set_value(slot, strdupz(value));
  1067. }
  1068. static void build_info_set_status(BUILD_INFO_SLOT slot, bool status) {
  1069. BUILD_INFO[slot].status = status;
  1070. }
  1071. __attribute__((constructor)) void initialize_build_info(void) {
  1072. build_info_set_value(BIB_PACKAGING_NETDATA_VERSION, program_version);
  1073. build_info_set_value(BIB_PACKAGING_CONFIGURE_OPTIONS, CONFIGURE_COMMAND);
  1074. #ifdef COMPILED_FOR_LINUX
  1075. build_info_set_status(BIB_FEATURE_BUILT_FOR, true);
  1076. build_info_set_value(BIB_FEATURE_BUILT_FOR, "Linux");
  1077. build_info_set_status(BIB_PLUGIN_LINUX_CGROUPS, true);
  1078. build_info_set_status(BIB_PLUGIN_LINUX_PROC, true);
  1079. build_info_set_status(BIB_PLUGIN_LINUX_DISKSPACE, true);
  1080. build_info_set_status(BIB_PLUGIN_LINUX_TC, true);
  1081. #endif
  1082. #ifdef COMPILED_FOR_FREEBSD
  1083. build_info_set_status(BIB_FEATURE_BUILT_FOR, true);
  1084. build_info_set_value(BIB_FEATURE_BUILT_FOR, "FreeBSD");
  1085. build_info_set_status(BIB_PLUGIN_FREEBSD, true);
  1086. #endif
  1087. #ifdef COMPILED_FOR_MACOS
  1088. build_info_set_status(BIB_FEATURE_BUILT_FOR, true);
  1089. build_info_set_value(BIB_FEATURE_BUILT_FOR, "MacOS");
  1090. build_info_set_status(BIB_PLUGIN_MACOS, true);
  1091. #endif
  1092. #ifdef ENABLE_ACLK
  1093. build_info_set_status(BIB_FEATURE_CLOUD, true);
  1094. build_info_set_status(BIB_CONNECTIVITY_ACLK, true);
  1095. #else
  1096. build_info_set_status(BIB_FEATURE_CLOUD, false);
  1097. #ifdef DISABLE_CLOUD
  1098. build_info_set_value(BIB_FEATURE_CLOUD, "disabled");
  1099. #else
  1100. build_info_set_value(BIB_FEATURE_CLOUD, "unavailable");
  1101. #endif
  1102. #endif
  1103. build_info_set_status(BIB_FEATURE_HEALTH, true);
  1104. build_info_set_status(BIB_FEATURE_STREAMING, true);
  1105. build_info_set_status(BIB_FEATURE_BACKFILLING, true);
  1106. build_info_set_status(BIB_FEATURE_REPLICATION, true);
  1107. build_info_set_status(BIB_FEATURE_STREAMING_COMPRESSION, true);
  1108. #ifdef ENABLE_BROTLI
  1109. build_info_append_value(BIB_FEATURE_STREAMING_COMPRESSION, "brotli");
  1110. #endif
  1111. #ifdef ENABLE_ZSTD
  1112. build_info_append_value(BIB_FEATURE_STREAMING_COMPRESSION, "zstd");
  1113. #endif
  1114. #ifdef ENABLE_LZ4
  1115. build_info_append_value(BIB_FEATURE_STREAMING_COMPRESSION, "lz4");
  1116. #endif
  1117. build_info_append_value(BIB_FEATURE_STREAMING_COMPRESSION, "gzip");
  1118. build_info_set_status(BIB_FEATURE_CONTEXTS, true);
  1119. build_info_set_status(BIB_FEATURE_TIERING, true);
  1120. #ifdef ENABLE_ML
  1121. build_info_set_status(BIB_FEATURE_ML, true);
  1122. #endif
  1123. #ifdef ENABLE_DBENGINE
  1124. build_info_set_status(BIB_DB_DBENGINE, true);
  1125. #endif
  1126. build_info_set_status(BIB_DB_ALLOC, true);
  1127. build_info_set_status(BIB_DB_RAM, true);
  1128. build_info_set_status(BIB_DB_MAP, true);
  1129. build_info_set_status(BIB_DB_SAVE, true);
  1130. build_info_set_status(BIB_DB_NONE, true);
  1131. build_info_set_status(BIB_CONNECTIVITY_HTTPD_STATIC, true);
  1132. #ifdef ENABLE_H2O
  1133. build_info_set_status(BIB_CONNECTIVITY_HTTPD_H2O, true);
  1134. #endif
  1135. #ifdef ENABLE_WEBRTC
  1136. build_info_set_status(BIB_CONNECTIVITY_WEBRTC, true);
  1137. #endif
  1138. #ifdef ENABLE_HTTPS
  1139. build_info_set_status(BIB_CONNECTIVITY_NATIVE_HTTPS, true);
  1140. #endif
  1141. #if defined(HAVE_X509_VERIFY_PARAM_set1_host) && HAVE_X509_VERIFY_PARAM_set1_host == 1
  1142. build_info_set_status(BIB_CONNECTIVITY_TLS_HOST_VERIFY, true);
  1143. #endif
  1144. #ifdef ENABLE_LZ4
  1145. build_info_set_status(BIB_LIB_LZ4, true);
  1146. #endif
  1147. #ifdef ENABLE_ZSTD
  1148. build_info_set_status(BIB_LIB_ZSTD, true);
  1149. #endif
  1150. build_info_set_status(BIB_LIB_ZLIB, true);
  1151. #ifdef HAVE_DLIB
  1152. build_info_set_status(BIB_LIB_DLIB, true);
  1153. build_info_set_value(BIB_LIB_DLIB, "bundled");
  1154. #endif
  1155. #ifdef HAVE_PROTOBUF
  1156. build_info_set_status(BIB_LIB_PROTOBUF, true);
  1157. #ifdef BUNDLED_PROTOBUF
  1158. build_info_set_value(BIB_LIB_PROTOBUF, "bundled");
  1159. #else
  1160. build_info_set_value(BIB_LIB_PROTOBUF, "system");
  1161. #endif
  1162. #endif
  1163. #ifdef HAVE_LIBDATACHANNEL
  1164. build_info_set_status(BIB_LIB_LIBDATACHANNEL, true);
  1165. #endif
  1166. #ifdef ENABLE_OPENSSL
  1167. build_info_set_status(BIB_LIB_OPENSSL, true);
  1168. #endif
  1169. #ifdef ENABLE_JSONC
  1170. build_info_set_status(BIB_LIB_JSONC, true);
  1171. #endif
  1172. #ifdef HAVE_CAPABILITY
  1173. build_info_set_status(BIB_LIB_LIBCAP, true);
  1174. #endif
  1175. #ifdef HAVE_CRYPTO
  1176. build_info_set_status(BIB_LIB_LIBCRYPTO, true);
  1177. #endif
  1178. #ifdef STORAGE_WITH_MATH
  1179. build_info_set_status(BIB_LIB_LIBM, true);
  1180. #endif
  1181. #ifdef ENABLE_JEMALLOC
  1182. build_info_set_status(BIB_LIB_JEMALLOC, true);
  1183. #endif
  1184. #ifdef ENABLE_TCMALLOC
  1185. build_info_set_status(BIB_LIB_TCMALLOC, true);
  1186. #endif
  1187. #ifdef ENABLE_APPS_PLUGIN
  1188. build_info_set_status(BIB_PLUGIN_APPS, true);
  1189. #endif
  1190. #ifdef HAVE_SETNS
  1191. build_info_set_status(BIB_PLUGIN_LINUX_CGROUP_NETWORK, true);
  1192. #endif
  1193. build_info_set_status(BIB_PLUGIN_STATSD, true);
  1194. build_info_set_status(BIB_PLUGIN_TIMEX, true);
  1195. build_info_set_status(BIB_PLUGIN_IDLEJITTER, true);
  1196. build_info_set_status(BIB_PLUGIN_BASH, true);
  1197. #ifdef ENABLE_DEBUGFS_PLUGIN
  1198. build_info_set_status(BIB_PLUGIN_DEBUGFS, true);
  1199. #endif
  1200. #ifdef HAVE_CUPS
  1201. build_info_set_status(BIB_PLUGIN_CUPS, true);
  1202. #endif
  1203. #ifdef HAVE_LIBBPF
  1204. build_info_set_status(BIB_PLUGIN_EBPF, true);
  1205. #endif
  1206. #ifdef HAVE_FREEIPMI
  1207. build_info_set_status(BIB_PLUGIN_FREEIPMI, true);
  1208. #endif
  1209. #ifdef HAVE_NFACCT
  1210. build_info_set_status(BIB_PLUGIN_NFACCT, true);
  1211. #endif
  1212. #ifdef ENABLE_PERF_PLUGIN
  1213. build_info_set_status(BIB_PLUGIN_PERF, true);
  1214. #endif
  1215. #ifdef ENABLE_SLABINFO
  1216. build_info_set_status(BIB_PLUGIN_SLABINFO, true);
  1217. #endif
  1218. #ifdef HAVE_LIBXENSTAT
  1219. build_info_set_status(BIB_PLUGIN_XEN, true);
  1220. #endif
  1221. #ifdef HAVE_XENSTAT_VBD_ERROR
  1222. build_info_set_status(BIB_PLUGIN_XEN_VBD_ERROR, true);
  1223. #endif
  1224. #ifdef ENABLE_LOGSMANAGEMENT
  1225. build_info_set_status(BIB_PLUGIN_LOGS_MANAGEMENT, true);
  1226. #endif
  1227. build_info_set_status(BIB_EXPORT_PROMETHEUS_EXPORTER, true);
  1228. build_info_set_status(BIB_EXPORT_GRAPHITE, true);
  1229. build_info_set_status(BIB_EXPORT_GRAPHITE_HTTP, true);
  1230. build_info_set_status(BIB_EXPORT_JSON, true);
  1231. build_info_set_status(BIB_EXPORT_JSON_HTTP, true);
  1232. build_info_set_status(BIB_EXPORT_OPENTSDB, true);
  1233. build_info_set_status(BIB_EXPORT_OPENTSDB_HTTP, true);
  1234. build_info_set_status(BIB_EXPORT_ALLMETRICS, true);
  1235. build_info_set_status(BIB_EXPORT_SHELL, true);
  1236. #ifdef HAVE_KINESIS
  1237. build_info_set_status(BIB_EXPORT_AWS_KINESIS, true);
  1238. #endif
  1239. #ifdef ENABLE_EXPORTING_PUBSUB
  1240. build_info_set_status(BIB_EXPORT_GCP_PUBSUB, true);
  1241. #endif
  1242. #ifdef HAVE_MONGOC
  1243. build_info_set_status(BIB_EXPORT_MONGOC, true);
  1244. #endif
  1245. #ifdef ENABLE_PROMETHEUS_REMOTE_WRITE
  1246. build_info_set_status(BIB_EXPORT_PROMETHEUS_REMOTE_WRITE, true);
  1247. #endif
  1248. #ifdef NETDATA_TRACE_ALLOCATIONS
  1249. build_info_set_status(BIB_DEVEL_TRACE_ALLOCATIONS, true);
  1250. #endif
  1251. #if defined(NETDATA_DEV_MODE) || defined(NETDATA_INTERNAL_CHECKS)
  1252. build_info_set_status(BIB_DEVELOPER_MODE, true);
  1253. #endif
  1254. }
  1255. // ----------------------------------------------------------------------------
  1256. // system info
  1257. int get_system_info(struct rrdhost_system_info *system_info);
  1258. static void populate_system_info(void) {
  1259. static bool populated = false;
  1260. static SPINLOCK spinlock = NETDATA_SPINLOCK_INITIALIZER;
  1261. if(populated)
  1262. return;
  1263. spinlock_lock(&spinlock);
  1264. if(populated) {
  1265. spinlock_unlock(&spinlock);
  1266. return;
  1267. }
  1268. struct rrdhost_system_info *system_info;
  1269. bool free_system_info = false;
  1270. if(localhost && localhost->system_info) {
  1271. system_info = localhost->system_info;
  1272. }
  1273. else {
  1274. system_info = callocz(1, sizeof(struct rrdhost_system_info));
  1275. get_system_info(system_info);
  1276. free_system_info = true;
  1277. }
  1278. build_info_set_value_strdupz(BIB_OS_KERNEL_NAME, system_info->kernel_name);
  1279. build_info_set_value_strdupz(BIB_OS_KERNEL_VERSION, system_info->kernel_version);
  1280. build_info_set_value_strdupz(BIB_OS_NAME, system_info->host_os_name);
  1281. build_info_set_value_strdupz(BIB_OS_ID, system_info->host_os_id);
  1282. build_info_set_value_strdupz(BIB_OS_ID_LIKE, system_info->host_os_id_like);
  1283. build_info_set_value_strdupz(BIB_OS_VERSION, system_info->host_os_version);
  1284. build_info_set_value_strdupz(BIB_OS_VERSION_ID, system_info->container_os_version_id);
  1285. build_info_set_value_strdupz(BIB_OS_DETECTION, system_info->host_os_detection);
  1286. build_info_set_value_strdupz(BIB_HW_CPU_CORES, system_info->host_cores);
  1287. build_info_set_value_strdupz(BIB_HW_CPU_FREQUENCY, system_info->host_cpu_freq);
  1288. build_info_set_value_strdupz(BIB_HW_RAM_SIZE, system_info->host_ram_total);
  1289. build_info_set_value_strdupz(BIB_HW_DISK_SPACE, system_info->host_disk_space);
  1290. build_info_set_value_strdupz(BIB_HW_ARCHITECTURE, system_info->architecture);
  1291. build_info_set_value_strdupz(BIB_HW_VIRTUALIZATION, system_info->virtualization);
  1292. build_info_set_value_strdupz(BIB_HW_VIRTUALIZATION_DETECTION, system_info->virt_detection);
  1293. build_info_set_value_strdupz(BIB_CONTAINER_NAME, system_info->container);
  1294. build_info_set_value_strdupz(BIB_CONTAINER_DETECTION, system_info->container_detection);
  1295. if(system_info->is_k8s_node && !strcmp(system_info->is_k8s_node, "true"))
  1296. build_info_set_value_strdupz(BIB_CONTAINER_ORCHESTRATOR, "kubernetes");
  1297. else
  1298. build_info_set_value_strdupz(BIB_CONTAINER_ORCHESTRATOR, "none");
  1299. build_info_set_value_strdupz(BIB_CONTAINER_OS_NAME, system_info->container_os_name);
  1300. build_info_set_value_strdupz(BIB_CONTAINER_OS_ID, system_info->container_os_id);
  1301. build_info_set_value_strdupz(BIB_CONTAINER_OS_ID_LIKE, system_info->container_os_id_like);
  1302. build_info_set_value_strdupz(BIB_CONTAINER_OS_VERSION, system_info->container_os_version);
  1303. build_info_set_value_strdupz(BIB_CONTAINER_OS_VERSION_ID, system_info->container_os_version_id);
  1304. build_info_set_value_strdupz(BIB_CONTAINER_OS_DETECTION, system_info->container_os_detection);
  1305. if(free_system_info)
  1306. rrdhost_system_info_free(system_info);
  1307. populated = true;
  1308. spinlock_unlock(&spinlock);
  1309. }
  1310. // ----------------------------------------------------------------------------
  1311. // packaging info
  1312. char *get_value_from_key(char *buffer, char *key) {
  1313. char *s = NULL, *t = NULL;
  1314. s = t = buffer + strlen(key) + 2;
  1315. if (s) {
  1316. while (*s == '\'')
  1317. s++;
  1318. while (*++t != '\0');
  1319. while (--t > s && *t == '\'')
  1320. *t = '\0';
  1321. }
  1322. return s;
  1323. }
  1324. void get_install_type(char **install_type, char **prebuilt_arch, char **prebuilt_dist) {
  1325. char *install_type_filename;
  1326. int install_type_filename_len = (strlen(netdata_configured_user_config_dir) + strlen(".install-type") + 3);
  1327. install_type_filename = mallocz(sizeof(char) * install_type_filename_len);
  1328. snprintfz(install_type_filename, install_type_filename_len - 1, "%s/%s", netdata_configured_user_config_dir, ".install-type");
  1329. FILE *fp = fopen(install_type_filename, "r");
  1330. if (fp) {
  1331. char *s, buf[256 + 1];
  1332. size_t len = 0;
  1333. while ((s = fgets_trim_len(buf, 256, fp, &len))) {
  1334. if (!strncmp(buf, "INSTALL_TYPE='", 14))
  1335. *install_type = strdupz((char *)get_value_from_key(buf, "INSTALL_TYPE"));
  1336. else if (!strncmp(buf, "PREBUILT_ARCH='", 15))
  1337. *prebuilt_arch = strdupz((char *)get_value_from_key(buf, "PREBUILT_ARCH"));
  1338. else if (!strncmp(buf, "PREBUILT_DISTRO='", 17))
  1339. *prebuilt_dist = strdupz((char *)get_value_from_key(buf, "PREBUILT_DISTRO"));
  1340. }
  1341. fclose(fp);
  1342. }
  1343. freez(install_type_filename);
  1344. }
  1345. static struct {
  1346. SPINLOCK spinlock;
  1347. bool populated;
  1348. char *install_type;
  1349. char *prebuilt_arch;
  1350. char *prebuilt_distro;
  1351. } BUILD_PACKAGING_INFO = { 0 };
  1352. static void populate_packaging_info() {
  1353. if(!BUILD_PACKAGING_INFO.populated) {
  1354. spinlock_lock(&BUILD_PACKAGING_INFO.spinlock);
  1355. if(!BUILD_PACKAGING_INFO.populated) {
  1356. BUILD_PACKAGING_INFO.populated = true;
  1357. get_install_type(&BUILD_PACKAGING_INFO.install_type, &BUILD_PACKAGING_INFO.prebuilt_arch, &BUILD_PACKAGING_INFO.prebuilt_distro);
  1358. if(!BUILD_PACKAGING_INFO.install_type)
  1359. BUILD_PACKAGING_INFO.install_type = "unknown";
  1360. if(!BUILD_PACKAGING_INFO.prebuilt_arch)
  1361. BUILD_PACKAGING_INFO.prebuilt_arch = "unknown";
  1362. if(!BUILD_PACKAGING_INFO.prebuilt_distro)
  1363. BUILD_PACKAGING_INFO.prebuilt_distro = "unknown";
  1364. build_info_set_value(BIB_PACKAGING_INSTALL_TYPE, strdupz(BUILD_PACKAGING_INFO.install_type));
  1365. build_info_set_value(BIB_PACKAGING_ARCHITECTURE, strdupz(BUILD_PACKAGING_INFO.prebuilt_arch));
  1366. build_info_set_value(BIB_PACKAGING_DISTRO, strdupz(BUILD_PACKAGING_INFO.prebuilt_distro));
  1367. }
  1368. spinlock_unlock(&BUILD_PACKAGING_INFO.spinlock);
  1369. }
  1370. }
  1371. // ----------------------------------------------------------------------------
  1372. static void populate_directories(void) {
  1373. build_info_set_value(BIB_DIR_USER_CONFIG, netdata_configured_user_config_dir);
  1374. build_info_set_value(BIB_DIR_STOCK_CONFIG, netdata_configured_stock_config_dir);
  1375. build_info_set_value(BIB_DIR_CACHE, netdata_configured_cache_dir);
  1376. build_info_set_value(BIB_DIR_LIB, netdata_configured_varlib_dir);
  1377. build_info_set_value(BIB_DIR_PLUGINS, netdata_configured_primary_plugins_dir);
  1378. build_info_set_value(BIB_DIR_WEB, netdata_configured_web_dir);
  1379. build_info_set_value(BIB_DIR_LOG, netdata_configured_log_dir);
  1380. build_info_set_value(BIB_DIR_LOCK, netdata_configured_lock_dir);
  1381. build_info_set_value(BIB_DIR_HOME, netdata_configured_home_dir);
  1382. }
  1383. // ----------------------------------------------------------------------------
  1384. static void print_build_info_category_to_json(BUFFER *b, BUILD_INFO_CATEGORY category, const char *key) {
  1385. buffer_json_member_add_object(b, key);
  1386. for(size_t i = 0; i < BIB_TERMINATOR ;i++) {
  1387. if(BUILD_INFO[i].category == category && BUILD_INFO[i].json) {
  1388. if(BUILD_INFO[i].value)
  1389. buffer_json_member_add_string(b, BUILD_INFO[i].json, BUILD_INFO[i].value);
  1390. else
  1391. buffer_json_member_add_boolean(b, BUILD_INFO[i].json, BUILD_INFO[i].status);
  1392. }
  1393. }
  1394. buffer_json_object_close(b); // key
  1395. }
  1396. static void print_build_info_category_to_console(BUILD_INFO_CATEGORY category, const char *title) {
  1397. printf("%s:\n", title);
  1398. for(size_t i = 0; i < BIB_TERMINATOR ;i++) {
  1399. if(BUILD_INFO[i].category == category && BUILD_INFO[i].print) {
  1400. const char *v = BUILD_INFO[i].status ? "YES" : "NO";
  1401. const char *k = BUILD_INFO[i].print;
  1402. const char *d = BUILD_INFO[i].value;
  1403. int padding_length = 60 - strlen(k) - 1;
  1404. if (padding_length < 0) padding_length = 0;
  1405. char padding[padding_length + 1];
  1406. memset(padding, '_', padding_length);
  1407. padding[padding_length] = '\0';
  1408. if(BUILD_INFO[i].type == BIT_STRING)
  1409. printf(" %s %s : %s\n", k, padding, d?d:"unknown");
  1410. else
  1411. printf(" %s %s : %s%s%s%s\n", k, padding, v,
  1412. d?" (":"", d?d:"", d?")":"");
  1413. }
  1414. }
  1415. }
  1416. void print_build_info(void) {
  1417. populate_packaging_info();
  1418. populate_system_info();
  1419. populate_directories();
  1420. print_build_info_category_to_console(BIC_PACKAGING, "Packaging");
  1421. print_build_info_category_to_console(BIC_DIRECTORIES, "Default Directories");
  1422. print_build_info_category_to_console(BIC_OPERATING_SYSTEM, "Operating System");
  1423. print_build_info_category_to_console(BIC_HARDWARE, "Hardware");
  1424. print_build_info_category_to_console(BIC_CONTAINER, "Container");
  1425. print_build_info_category_to_console(BIC_FEATURE, "Features");
  1426. print_build_info_category_to_console(BIC_DATABASE, "Database Engines");
  1427. print_build_info_category_to_console(BIC_CONNECTIVITY, "Connectivity Capabilities");
  1428. print_build_info_category_to_console(BIC_LIBS, "Libraries");
  1429. print_build_info_category_to_console(BIC_PLUGINS, "Plugins");
  1430. print_build_info_category_to_console(BIC_EXPORTERS, "Exporters");
  1431. print_build_info_category_to_console(BIC_DEBUG_DEVEL, "Debug/Developer Features");
  1432. };
  1433. void build_info_to_json_object(BUFFER *b) {
  1434. populate_packaging_info();
  1435. populate_system_info();
  1436. populate_directories();
  1437. print_build_info_category_to_json(b, BIC_PACKAGING, "package");
  1438. print_build_info_category_to_json(b, BIC_DIRECTORIES, "directories");
  1439. print_build_info_category_to_json(b, BIC_OPERATING_SYSTEM, "os");
  1440. print_build_info_category_to_json(b, BIC_HARDWARE, "hw");
  1441. print_build_info_category_to_json(b, BIC_CONTAINER, "container");
  1442. print_build_info_category_to_json(b, BIC_FEATURE, "features");
  1443. print_build_info_category_to_json(b, BIC_DATABASE, "databases");
  1444. print_build_info_category_to_json(b, BIC_CONNECTIVITY, "connectivity");
  1445. print_build_info_category_to_json(b, BIC_LIBS, "libs");
  1446. print_build_info_category_to_json(b, BIC_PLUGINS, "plugins");
  1447. print_build_info_category_to_json(b, BIC_EXPORTERS, "exporters");
  1448. print_build_info_category_to_json(b, BIC_DEBUG_DEVEL, "debug-n-devel");
  1449. }
  1450. void print_build_info_json(void) {
  1451. populate_packaging_info();
  1452. populate_system_info();
  1453. populate_directories();
  1454. BUFFER *b = buffer_create(0, NULL);
  1455. buffer_json_initialize(b, "\"", "\"", 0, true, BUFFER_JSON_OPTIONS_DEFAULT);
  1456. build_info_to_json_object(b);
  1457. buffer_json_finalize(b);
  1458. printf("%s\n", buffer_tostring(b));
  1459. buffer_free(b);
  1460. };
  1461. void analytics_build_info(BUFFER *b) {
  1462. populate_packaging_info();
  1463. populate_system_info();
  1464. populate_directories();
  1465. size_t added = 0;
  1466. for(size_t i = 0; i < BIB_TERMINATOR ;i++) {
  1467. if(BUILD_INFO[i].analytics && BUILD_INFO[i].status) {
  1468. if(added)
  1469. buffer_strcat(b, "|");
  1470. buffer_strcat (b, BUILD_INFO[i].analytics);
  1471. added++;
  1472. }
  1473. }
  1474. }