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