buildinfo.c 51 KB

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