buildinfo.c 50 KB

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