]> git.ipfire.org Git - people/ms/telemetry.git/commitdiff
configure: Add the option to enable/disable sources individually
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Dec 2025 15:04:08 +0000 (15:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Dec 2025 15:04:08 +0000 (15:04 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
47 files changed:
configure.ac
m4/sources.m4 [new file with mode: 0644]
src/daemon/sources.c
src/daemon/sources/conntrack.c
src/daemon/sources/conntrack.h
src/daemon/sources/contextswitches.c
src/daemon/sources/contextswitches.h
src/daemon/sources/cpufreq.c
src/daemon/sources/cpufreq.h
src/daemon/sources/df.c
src/daemon/sources/df.h
src/daemon/sources/disk.c
src/daemon/sources/disk.h
src/daemon/sources/hostapd.c
src/daemon/sources/hostapd.h
src/daemon/sources/interfaces.c
src/daemon/sources/interfaces.h
src/daemon/sources/ipfrag4.c
src/daemon/sources/ipfrag4.h
src/daemon/sources/iptables.c
src/daemon/sources/iptables.h
src/daemon/sources/legacy-gateway-latency4.c
src/daemon/sources/legacy-gateway-latency4.h
src/daemon/sources/loadavg.c
src/daemon/sources/loadavg.h
src/daemon/sources/memory.c
src/daemon/sources/memory.h
src/daemon/sources/nftables.c
src/daemon/sources/nftables.h
src/daemon/sources/pressure-cpu.c
src/daemon/sources/pressure-cpu.h
src/daemon/sources/pressure-io.c
src/daemon/sources/pressure-io.h
src/daemon/sources/pressure-memory.c
src/daemon/sources/pressure-memory.h
src/daemon/sources/processor.c
src/daemon/sources/processor.h
src/daemon/sources/sensors.c
src/daemon/sources/sensors.h
src/daemon/sources/softirq.c
src/daemon/sources/softirq.h
src/daemon/sources/suricata.c
src/daemon/sources/suricata.h
src/daemon/sources/unbound.c
src/daemon/sources/unbound.h
src/daemon/sources/uptime.c
src/daemon/sources/uptime.h

index a53b0a66cd68db28fa59831cff9096bba0b4f9bb..80a00ce6755761e0d24845e61d9c9b5594332889 100644 (file)
@@ -207,6 +207,30 @@ AC_SUBST(SENSORS_LIBS)
 
 LIBS="$save_LIBS"
 
+# ------------------------------------------------------------------------------
+
+ENABLE_SOURCE([conntrack])
+ENABLE_SOURCE([contextswitches])
+ENABLE_SOURCE([cpufreq])
+ENABLE_SOURCE([df])
+ENABLE_SOURCE([disk])
+ENABLE_SOURCE([hostapd])
+ENABLE_SOURCE([interfaces], [$have_libnl3 $have_libnl3_route])
+ENABLE_SOURCE([ipfrag4])
+ENABLE_SOURCE([iptables], [$have_libiptc])
+ENABLE_SOURCE([legacy-gateway-latency4], [$have_libnl3 $have_libnl3_route])
+ENABLE_SOURCE([loadavg])
+ENABLE_SOURCE([memory])
+ENABLE_SOURCE([nftables], [$have_libmnl $have_libnftnl])
+ENABLE_SOURCE([pressure-cpu])
+ENABLE_SOURCE([pressure-io])
+ENABLE_SOURCE([pressure-memory])
+ENABLE_SOURCE([sensors], [$have_sensors])
+ENABLE_SOURCE([softirq])
+ENABLE_SOURCE([suricata])
+ENABLE_SOURCE([unbound])
+ENABLE_SOURCE([uptime])
+
 # ------------------------------------------------------------------------------
 have_manpages=no
 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages],
@@ -273,11 +297,35 @@ AC_MSG_RESULT([
 
        Generate man-pages:     ${have_manpages}
 
-       libatasmart:            ${have_libatasmart}
-       libiptc:                ${have_libiptc}
-       libmnl:                 ${have_libmnl}
-       libnftnl:               ${have_libnftnl}
-       libnl-3:                ${have_libnl3}
-       libnl-3-route:          ${have_libnl3_route}
-       sensors:                ${have_sensors}
+       Dependencies:
+               libatasmart:                    ${have_libatasmart}
+               libiptc:                        ${have_libiptc}
+               libmnl:                         ${have_libmnl}
+               libnftnl:                       ${have_libnftnl}
+               libnl-3:                        ${have_libnl3}
+               libnl-3-route:                  ${have_libnl3_route}
+               sensors:                        ${have_sensors}
+
+       Sources:
+               conntrack:                      ${build_source_interfaces}
+               contextswitches:                ${build_source_contextswitches}
+               cpufreq:                        ${build_source_cpufreq}
+               df:                             ${build_source_df}
+               disk:                           ${build_source_disk}
+               hostapd:                        ${build_source_hostapd}
+               interfaces:                     ${build_source_interfaces}
+               ipfrag4:                        ${build_source_ipfrag4}
+               iptables:                       ${build_source_iptables}
+               legacy-gateway-latency4:        ${build_source_legacy_gateway_latency4}
+               loadavg:                        ${build_source_loadavg}
+               memory:                         ${build_source_memory}
+               nftables:                       ${build_source_nftables}
+               pressure-cpu:                   ${build_source_pressure_cpu}
+               pressure-io:                    ${build_source_pressure_io}
+               pressure-memory:                ${build_source_pressure_memory}
+               sensors:                        ${build_source_sensors}
+               softirq:                        ${build_source_softirq}
+               suricata:                       ${build_source_suricata}
+               unbound:                        ${build_source_unbound}
+               uptime:                         ${build_source_uptime}
 ])
diff --git a/m4/sources.m4 b/m4/sources.m4
new file mode 100644 (file)
index 0000000..7d84bd3
--- /dev/null
@@ -0,0 +1,57 @@
+AC_DEFUN([ENABLE_SOURCE], [
+       # Replace hyphens with underscores
+       source=`echo "$1" | tr '-' '_'`
+
+       # Make the name uppercase for the macro
+       source_uppercase=`echo "$source" | tr 'a-z' 'A-Z'`
+
+       AC_ARG_ENABLE([$1],
+               AS_HELP_STRING([--enable-$1], [enable $1 source (auto/yes/no)]),
+               [eval enable_source_$source="$enableval"],
+               [eval enable_source_$source="auto"]
+       )
+
+    # Determine if all dependencies are present
+    all_deps=yes
+    for dep in $2; do
+        if test "x$dep" != "xyes"; then
+            all_deps=no
+            break
+        fi
+    done
+
+       eval "val=\$enable_source_$source"
+
+       case "$val" in
+               yes)
+                       if test "x$all_deps" != "xyes"; then
+                               AC_MSG_ERROR([source '$1' requested but one or more dependencies missing])
+                       fi
+                       eval build_source_$source=yes
+                       ;;
+
+               no)
+                       eval build_source_$source=no
+                       ;;
+
+               auto)
+                       if test "x$all_deps" = "xyes"; then
+                               eval build_source_$source=yes
+                       else
+                               eval build_source_$source=no
+                       fi
+                       ;;
+
+               *)
+                       AC_MSG_ERROR([Invalid value for --enable-$1=$val])
+                       ;;
+       esac
+
+       eval "val=\$build_source_$source"
+
+       if test "x$val" = "xyes"; then
+               AC_DEFINE_UNQUOTED([BUILD_SOURCE_$source_uppercase], [1], [Build the $1 source])
+       else
+               AC_DEFINE_UNQUOTED([BUILD_SOURCE_$source_uppercase], [0], [Build the $1 source])
+       fi
+])
index 3c5f2b871ccaaa94bc960cf5681c271cb572dbdd..6e7ed621e1cd66cbd173fe56b094790dec9ad15e 100644 (file)
 #include "sources/df.h"
 #include "sources/disk.h"
 #include "sources/hostapd.h"
+#include "sources/interfaces.h"
 #include "sources/ipfrag4.h"
+#include "sources/iptables.h"
+#include "sources/legacy-gateway-latency4.h"
 #include "sources/loadavg.h"
 #include "sources/memory.h"
+#include "sources/nftables.h"
 #include "sources/pressure-cpu.h"
 #include "sources/pressure-io.h"
 #include "sources/pressure-memory.h"
 #include "sources/processor.h"
+#include "sources/sensors.h"
 #include "sources/softirq.h"
 #include "sources/suricata.h"
 #include "sources/unbound.h"
 #include "sources/uptime.h"
 
-// legacy gateway latency4
-#ifdef HAVE_LIBNL3
-# ifdef HAVE_LIBNL3_ROUTE
-#  include "sources/interfaces.h"
-# endif /* HAVE_LIBNL3_ROUTE */
-#endif /* HAVE_LIBNL3 */
-
-// iptables
-#ifdef HAVE_LIBIPTC
-# include "sources/iptables.h"
-#endif /* HAVE_LIBIPTC */
-
-// legacy gateway latency4
-#ifdef HAVE_LIBNL3
-# ifdef HAVE_LIBNL3_ROUTE
-#  include "sources/legacy-gateway-latency4.h"
-# endif /* HAVE_LIBNL3_ROUTE */
-#endif /* HAVE_LIBNL3 */
-
-// nftables
-#ifdef HAVE_LIBMNL
-# ifdef HAVE_LIBNFTNL
-#  include "sources/nftables.h"
-# endif /* HAVE_LIBNFTNL */
-#endif /* HAVE_LIBMNL */
-
-// sensors
-#ifdef HAVE_SENSORS
-# include "sources/sensors.h"
-#endif /* HAVE_SENSORS */
-
 // Load test sources
 #if ENABLE_TESTS
 # include "sources/test-error.h"
 
 // Register all sources
 static const td_source_impl* source_impls[] = {
+#ifdef BUILD_SOURCE_CONNTRACK
        &conntrack_source,
+#endif /* BUILD_SOURCE_CONNTRACK */
+
+#ifdef BUILD_SOURCE_CONNTEXTSWITCHES
        &contextswitches_source,
+#endif /* BUILD_SOURCE_CONNTEXTSWITCHES */
+
+#ifdef BUILD_SOURCE_CPUFREQ
        &cpufreq_source,
+#endif /* BUILD_SOURCE_CPUFREQ */
+
+#ifdef BUILD_SOURCE_DF
        &df_source,
+#endif /* BUILD_SOURCE_DF */
+
+#ifdef BUILD_SOURCE_DISK
        &disk_source,
+#endif /* BUILD_SOURCE_DISK */
+
+#ifdef BUILD_SOURCE_HOSTAPD
        &hostapd_source,
-       &ipfrag4_source,
-       &loadavg_source,
-       &memory_source,
-       &pressure_cpu_source,
-       &pressure_io_source,
-       &pressure_memory_source,
-       &processor_source,
-       &softirq_source,
-       &suricata_source,
-       &unbound_source,
-       &uptime_source,
+#endif /* BUILD_SOURCE_HOSTAPD */
 
-       // Interfaces
-#ifdef HAVE_LIBNL3
-# ifdef HAVE_LIBNL3_ROUTE
+#ifdef BUILD_SOURCE_INTERFACES
        &interfaces_source,
-# endif /* HAVE_LIBNL3_ROUTE */
-#endif /* HAVE_LIBNL3 */
+#endif /* BUILD_SOURCE_INTERFACES */
 
-       // iptables
-#ifdef HAVE_LIBIPTC
+#ifdef BUILD_SOURCE_IPFRAG4
+       &ipfrag4_source,
+#endif /* BUILD_SOURCE_IPFRAG4 */
+
+#ifdef BUILD_SOURCE_IPTABLES
        &iptables_source,
-#endif /* HAVE_LIBIPTC */
+#endif /* BUILD_SOURCE_IPTABLES */
 
-       // legacy gateway latency4
-#ifdef HAVE_LIBNL3
-# ifdef HAVE_LIBNL3_ROUTE
+#ifdef BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4
        &legacy_gateway_latency4_source,
-# endif /* HAVE_LIBNL3_ROUTE */
-#endif /* HAVE_LIBNL3 */
+#endif /* BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4 */
 
-       // nftables
-#ifdef HAVE_LIBMNL
-# ifdef HAVE_LIBNFTNL
+#ifdef BUILD_SOURCE_LOADAVG
+       &loadavg_source,
+#endif /* BUILD_SOURCE_LOADAVG */
+
+#ifdef BUILD_SOURCE_MEMORY
+       &memory_source,
+#endif /* BUILD_SOURCE_MEMORY */
+
+#ifdef BUILD_SOURCE_NFTABLES
        &nftables_source,
-# endif /* HAVE_LIBNFTNL */
-#endif /* HAVE_LIBMNL */
+#endif /* BUILD_SOURCE_NFTABLES */
+
+#ifdef BUILD_SOURCE_PRESSURE_CPU
+       &pressure_cpu_source,
+#endif /* BUILD_SOURCE_PRESSURE_CPU */
 
-       // sensors
-#ifdef HAVE_SENSORS
+#ifdef BUILD_SOURCE_PRESSURE_IO
+       &pressure_io_source,
+#endif /* BUILD_SOURCE_PRESSURE_IO */
+
+#ifdef BUILD_SOURCE_PRESSURE_MEMORY
+       &pressure_memory_source,
+#endif /* BUILD_SOURCE_PRESSURE_MEMORY */
+
+#ifdef BUILD_SOURCE_PROCESSOR
+       &processor_source,
+#endif /* BUILD_SOURCE_PROCESSOR */
+
+#ifdef BUILD_SOURCE_SENSORS
        &sensors_input_source,
        &sensors_fan_source,
        &sensors_temp_source,
        &sensors_power_source,
        &sensors_energy_source,
        &sensors_current_source,
-#endif /* HAVE_SENSORS */
+#endif /* BUILD_SOURCE_SENSORS */
+
+#ifdef BUILD_SOURCE_SOFTIRQ
+       &softirq_source,
+#endif /* BUILD_SOURCE_SOFTIRQ */
+
+#ifdef BUILD_SOURCE_SURICATA
+       &suricata_source,
+#endif /* BUILD_SOURCE_SURICATA */
+
+#ifdef BUILD_SOURCE_UNBOUND
+       &unbound_source,
+#endif /* BUILD_SOURCE_UNBOUND */
+
+#ifdef BUILD_SOURCE_UPTIME
+       &uptime_source,
+#endif /* BUILD_SOURCE_UPTIME */
 
 #if ENABLE_TESTS
        // Tests
index 2cc4bbe51a16485a78b8464ed187646ce8615a56..f5c4299b004b363b2086ac95c0da7ca6c206bab3 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_CONNTRACK
+
 #include <string.h>
 
 #include "../ctx.h"
@@ -66,3 +68,5 @@ const td_source_impl conntrack_source = {
        // Methods
        .heartbeat = conntrack_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_CONNTRACK */
index 40608f103fbcb54afd08c31bbb0c377849e00bd9..836e2f3fe74d544ec1cb0a585b64fcc1589f09b5 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_CONNTRACK_H
 #define TELEMETRY_SOURCE_CONNTRACK_H
+#ifdef BUILD_SOURCE_CONNTRACK
 
 #include "../source.h"
 
 extern const td_source_impl conntrack_source;
 
+#endif /* BUILD_SOURCE_CONNTRACK */
 #endif /* TELEMETRY_SOURCE_CONNTRACK_H */
index 92a5122c81d2b262179c4dcf769bee3496084447..96df86108de4283edd6171d8e45495663efaaad7 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_CONTEXTSWITCHES
+
 #include <errno.h>
 #include <linux/perf_event.h>
 #include <stdlib.h>
@@ -133,3 +135,5 @@ const td_source_impl contextswitches_source = {
        .free      = contextswitches_free,
        .heartbeat = contextswitches_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_CONTEXTSWITCHES */
index 0b10c9f442607c939d42b60cdde1ebf503d04f4e..54622fbe9ac18d34b7d25b3bccfc9e557ccaa287 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_CONTEXTSWITCHES_H
 #define TELEMETRY_SOURCE_CONTEXTSWITCHES_H
+#ifdef BUILD_SOURCE_CONTEXTSWITCHES
 
 #include "../source.h"
 
 extern const td_source_impl contextswitches_source;
 
+#endif /* BUILD_SOURCE_CONTEXTSWITCHES */
 #endif /* TELEMETRY_SOURCE_CONTEXTSWITCHES_H */
index 94cd99db4e1780971ef152cbe8d2c99d35fed399..22a069148cfa582e0a8001b50a4f6430428d5fd8 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_CPUFREQ
+
 #include <errno.h>
 #include <limits.h>
 #include <unistd.h>
@@ -117,3 +119,5 @@ const td_source_impl cpufreq_source = {
        // Methods
        .heartbeat = cpufreq_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_CPUFREQ */
index 7bb61f7d094bd50c87a6b1c53e8bf284a4af409f..284d747f674a3b67b912969916ff007d6ae22dd8 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_CPUFREQ_H
 #define TELEMETRY_SOURCE_CPUFREQ_H
+#ifdef BUILD_SOURCE_CPUFREQ
 
 #include "../source.h"
 
 extern const td_source_impl cpufreq_source;
 
+#endif /* BUILD_SOURCE_CPUFREQ */
 #endif /* TELEMETRY_SOURCE_CPUFREQ_H */
index d57b5f92c0140132124998987351e0d2ee371ce0..24a4538aaf4e42c208437a6cdfd4bad949357c48 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_DF
+
 #include <errno.h>
 #include <mntent.h>
 #include <sys/statvfs.h>
@@ -101,3 +103,5 @@ const td_source_impl df_source = {
        // Methods
        .heartbeat = df_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_DF */
index 3d386e1a89c20fef5f40d4200e8ad22d1514af1a..2036f537334ac0472f1babb8639670d29c2bde0e 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_DF_H
 #define TELEMETRY_SOURCE_DF_H
+#ifdef BUILD_SOURCE_DF
 
 #include "../source.h"
 
 extern const td_source_impl df_source;
 
+#endif /* BUILD_SOURCE_DF */
 #endif /* TELEMETRY_SOURCE_DF_H */
index 945cf13ddc59695c103d68dfab7f744516584c24..3c1d78912217b2eba4162be8713fe86772c059e5 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_DISK
+
 #include <errno.h>
 #include <limits.h>
 
@@ -485,3 +487,5 @@ const td_source_impl disk_source = {
        // Methods
        .heartbeat = disk_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_DISK */
index 65d03c047a7087b28ae3f4c430bd6829bff64182..12af0ace1095713584c42822e6f8ff61694176bb 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_DISK_H
 #define TELEMETRY_SOURCE_DISK_H
+#ifdef BUILD_SOURCE_DISK
 
 #include "../source.h"
 
 extern const td_source_impl disk_source;
 
+#endif /* BUILD_SOURCE_DISK */
 #endif /* TELEMETRY_SOURCE_DISK_H */
index aebf055fe0ea9606834b0e35ef25b75bcd8b9d03..5cad5cf14bf4d66aefa4f0ba66dc37caebaf7bd2 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_HOSTAPD
+
 #include <errno.h>
 #include <net/ethernet.h>
 #include <netinet/ether.h>
@@ -256,3 +258,5 @@ const td_source_impl hostapd_source = {
        // Methods
        .heartbeat = hostapd_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_HOSTAPD */
index c476388661215ef07f492750f29856ba76976e0c..3416ecceb8684596151cf912c2a5821abae78d71 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_HOSTAPD_H
 #define TELEMETRY_SOURCE_HOSTAPD_H
+#ifdef BUILD_SOURCE_HOSTAPD
 
 #include "../source.h"
 
 extern const td_source_impl hostapd_source;
 
+#endif /* BUILD_SOURCE_HOSTAPD */
 #endif /* TELEMETRY_SOURCE_HOSTAPD_H */
index a2183136b24b3ef283bc36015e7d309372b18df8..2222c286fefc7b0dc24eea3634fecf33ff17d6f3 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_INTERFACES
+
 #include <errno.h>
 #include <limits.h>
 
@@ -232,3 +234,5 @@ const td_source_impl interfaces_source = {
        // Methods
        .heartbeat = interfaces_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_INTERFACES */
index 754679ba748a7612309307ba4115a20e06434055..1c1856b20eee3f121af044221c10cc32c274a724 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_INTERFACES_H
 #define TELEMETRY_SOURCE_INTERFACES_H
+#ifdef BUILD_SOURCE_INTERFACES
 
 #include "../source.h"
 
 extern const td_source_impl interfaces_source;
 
+#endif /* BUILD_SOURCE_INTERFACES */
 #endif /* TELEMETRY_SOURCE_INTERFACES_H */
index e1a3e3a444fd30c3292ff2b1b4c671751245361a..c4a6e422aa7c765cabd7ac63863ce3aade06fc53 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_IPFRAG4
+
 #include "../ctx.h"
 #include "../proto.h"
 #include "../source.h"
@@ -121,3 +123,5 @@ const td_source_impl ipfrag4_source = {
        // Methods
        .heartbeat = ipfrag4_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_IPFRAG4 */
index cc0d05b2a93739cacf295f496318385fd7ddfccd..e42a01a503cf9aaa7c3a5c09672352b6b4e41188 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_IPFRAG4_H
 #define TELEMETRY_SOURCE_IPFRAG4_H
+#ifdef BUILD_SOURCE_IPFRAG4
 
 #include "../source.h"
 
 extern const td_source_impl ipfrag4_source;
 
+#endif /* BUILD_SOURCE_IPFRAG4 */
 #endif /* TELEMETRY_SOURCE_IPFRAG4_H */
index 19fcc10fb0122173654ce8a9253517c358d31cac..81f55605bc5f9a19cd29099b8ec5704281385ff7 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_IPTABLES
+
 #include <libiptc/libiptc.h>
 
 #include <linux/netfilter/x_tables.h>
@@ -248,3 +250,5 @@ const td_source_impl iptables_source = {
        // Methods
        .heartbeat = iptables_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_IPTABLES */
index 58544518e29cc8542276fd44b8559e9293483bb2..c0cde65e6ca9d25d4b0bb7693ad43eb85efd88d9 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_IPTABLES_H
 #define TELEMETRY_SOURCE_IPTABLES_H
+#ifdef BUILD_SOURCE_IPTABLES
 
 #include "../source.h"
 
 extern const td_source_impl iptables_source;
 
+#endif /* BUILD_SOURCE_IPTABLES */
 #endif /* TELEMETRY_SOURCE_IPTABLES_H */
index 2040d486ac70f3cba28e28bc110f38236a4a8283..72321b9aa97357c7e1457fdd0965b4a3fe7d4bd6 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4
+
 #include <errno.h>
 #include <limits.h>
 #include <linux/if_arp.h>
@@ -236,3 +238,5 @@ const td_source_impl legacy_gateway_latency4_source = {
        // Methods
        .heartbeat = legacy_gateway_latency4_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4 */
index 0b14dca1ea1ebbcb8139c7a8c726fec49818a675..6b2f3e7eafa1cb1b22b73b2ba358610c8e637d0c 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_LEGACY_GATEWAY_LATENCY4_H
 #define TELEMETRY_SOURCE_LEGACY_GATEWAY_LATENCY4_H
+#ifdef BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4
 
 #include "../source.h"
 
 extern const td_source_impl legacy_gateway_latency4_source;
 
+#endif /* BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4 */
 #endif /* TELEMETRY_SOURCE_LEGACY_GATEWAY_LATENCY4_H */
index c50623437882f573189767f7b2c12b8ed96cb25f..de8674fba52ce1fa48c4862ee68db7d2f06255e2 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_LOADAVG
+
 #include <stdlib.h>
 
 #include "../ctx.h"
@@ -55,3 +57,5 @@ const td_source_impl loadavg_source = {
        // Methods
        .heartbeat = loadavg_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_LOADAVG */
index f604416c1ff750256314f876af7e0ece9802cc10..8d32cca99f45c68b6e88e737480f767d8968da9b 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_LOADAVG_H
 #define TELEMETRY_SOURCE_LOADAVG_H
+#ifdef BUILD_SOURCE_LOADAVG
 
 #include "../source.h"
 
 extern const td_source_impl loadavg_source;
 
+#endif /* BUILD_SOURCE_LOADAVG */
 #endif /* TELEMETRY_SOURCE_LOADAVG_H */
index 85f663013659902c88a5023faf12a9136a5b7e0a..f9868fd7219d5a914c3b4745358826eec2b92f0f 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_MEMORY
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -85,3 +87,5 @@ const td_source_impl memory_source = {
        // Methods
        .heartbeat = memory_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_MEMORY */
index 0a9ca1abed7db0bb80ac4db7fb39e15d603174e6..bfe02c207a08bfbacfd84712baef512086b2e884 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_MEMORY_H
 #define TELEMETRY_SOURCE_MEMORY_H
+#ifdef BUILD_SOURCE_MEMORY
 
 #include "../source.h"
 
 extern const td_source_impl memory_source;
 
+#endif /* BUILD_SOURCE_MEMORY */
 #endif /* TELEMETRY_SOURCE_MEMORY_H */
index aabfe53bde3d29b065b19afc655a4bdbaf0e2fed..21d519d49c6656b8421897bd63762fd9d8b6884e 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_NFTABLES
+
 #include <linux/netfilter/nf_tables.h>
 
 #include <libmnl/libmnl.h>
@@ -385,3 +387,5 @@ const td_source_impl nftables_source = {
        .free      = nftables_free,
        .heartbeat = nftables_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_NFTABLES */
index 2555fc7bd6ce6122e5d96d777f90915cc8cabd6b..d2ce818f7f63a582de53c86340959898856a17e7 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_NFTABLES_H
 #define TELEMETRY_SOURCE_NFTABLES_H
+#ifdef BUILD_SOURCE_NFTABLES
 
 #include "../source.h"
 
 extern const td_source_impl nftables_source;
 
+#endif /* BUILD_SOURCE_NFTABLES */
 #endif /* TELEMETRY_SOURCE_NFTABLES_H */
index 11443920cffd08639a452f4b1910596384249883..f8ccef731dcf66796b68d1490fc48f1398db59eb 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_PRESSURE_CPU
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -67,3 +69,5 @@ const td_source_impl pressure_cpu_source = {
        // Methods
        .heartbeat = pressure_cpu_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_PRESSURE_CPU */
index ef615448a2c2899e7d601b1b403afac70acbc263..556cf8131216551e79d46ff4b96f7b22de5fff3e 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_PRESSURE_CPU_H
 #define TELEMETRY_SOURCE_PRESSURE_CPU_H
+#ifdef BUILD_SOURCE_PRESSURE_CPU
 
 #include "../source.h"
 
 extern const td_source_impl pressure_cpu_source;
 
+#endif /* BUILD_SOURCE_PRESSURE_CPU */
 #endif /* TELEMETRY_SOURCE_PRESSURE_CPU_H */
index 1734d478ca9e0a86fdc03dc3eaddd93d34f6317a..27519a86297179d13f5a7ab136d174985e41e0f7 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_PRESSURE_IO
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -67,3 +69,5 @@ const td_source_impl pressure_io_source = {
        // Methods
        .heartbeat = pressure_io_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_PRESSURE_IO */
index 8591182fcc3aee916c875b948af416fb4e59b934..7c32ffe701d46b8af88d3b631d125d6525bc6d91 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_PRESSURE_IO_H
 #define TELEMETRY_SOURCE_PRESSURE_IO_H
+#ifdef BUILD_SOURCE_PRESSURE_IO
 
 #include "../source.h"
 
 extern const td_source_impl pressure_io_source;
 
+#endif /* BUILD_SOURCE_PRESSURE_IO */
 #endif /* TELEMETRY_SOURCE_PRESSURE_IO_H */
index f1f4a585f3d2b8d485008e3ad8eeaaf5a572227a..89f812bf3a83365dbc85c702f8568c31a0f899d1 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_PRESSURE_MEMORY
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -67,3 +69,5 @@ const td_source_impl pressure_memory_source = {
        // Methods
        .heartbeat = pressure_memory_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_PRESSURE_MEMORY */
index 3448c40de1b408bfc9152fb3f1ecadd4f989bbaf..13bbfa230e69a0a423052fff044914e2b345941f 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_PRESSURE_MEMORY_H
 #define TELEMETRY_SOURCE_PRESSURE_MEMORY_H
+#ifdef BUILD_SOURCE_PRESSURE_MEMORY
 
 #include "../source.h"
 
 extern const td_source_impl pressure_memory_source;
 
+#endif /* BUILD_SOURCE_PRESSURE_MEMORY */
 #endif /* TELEMETRY_SOURCE_PRESSURE_MEMORY_H */
index f5d7012b23c82a2893a0ceff576660a22cc866c3..bc565acc946552cb14f9ddbe1b234ac890fa7011 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_PROCESSOR
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -71,3 +73,5 @@ const td_source_impl processor_source = {
        // Methods
        .heartbeat = processor_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_PROCESSOR */
index 35b3e80fd27c7816dd14c25cb474e6a6782ac79d..0d93ce40cd53d5b9d93845e6c8ecbd23658e4804 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_PROCESSOR_H
 #define TELEMETRY_SOURCE_PROCESSOR_H
+#ifdef BUILD_SOURCE_PROCESSOR
 
 #include "../source.h"
 
 extern const td_source_impl processor_source;
 
+#endif /* BUILD_SOURCE_PROCESSOR */
 #endif /* TELEMETRY_SOURCE_PROCESSOR_H */
index 0b093b62dfa6341b32e4a01231954e5f3be34508..be3483b06fd0713b5e4066d077e3f15148f87a91 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_SENSORS
+
 #include <ctype.h>
 #include <errno.h>
 
@@ -524,3 +526,5 @@ const td_source_impl sensors_current_source = {
        // Methods
        .heartbeat = sensors_current_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_SENSORS */
index 1223c8d1a5a4d416a79f8cc2381f3ce5f5921ee0..9996d376d95b5551acfb40f3adfef12950e41ab0 100644 (file)
@@ -20,6 +20,7 @@
 
 #ifndef TELEMETRY_SOURCE_SENSORS_H
 #define TELEMETRY_SOURCE_SENSORS_H
+#ifdef BUILD_SOURCE_SENSORS
 
 #include "../source.h"
 
@@ -30,4 +31,5 @@ extern const td_source_impl sensors_power_source;
 extern const td_source_impl sensors_energy_source;
 extern const td_source_impl sensors_current_source;
 
+#endif /* BUILD_SOURCE_SENSORS */
 #endif /* TELEMETRY_SOURCE_SENSORS_H */
index ad8b2fc3617479b5c78f29abfa1e28f7367be966..84c804141994240ab2d47454a5334ef69dde0516 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_SOFTIRQ
+
 #include "../ctx.h"
 #include "../proc.h"
 #include "../source.h"
@@ -48,3 +50,5 @@ const td_source_impl softirq_source = {
        // Methods
        .heartbeat = softirq_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_SOFTIRQ */
index 3de241223f2a0da9e3962c5089010ecf87428462..23b6ba07ccf9c46a12a73a5cb0c72bfe5e37970f 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_SOFTIRQS_H
 #define TELEMETRY_SOURCE_SOFTIRQS_H
+#ifdef BUILD_SOURCE_SOFTIRQ
 
 #include "../source.h"
 
 extern const td_source_impl softirq_source;
 
+#endif /* BUILD_SOURCE_SOFTIRQ */
 #endif /* TELEMETRY_SOURCE_SOFTIRQS_H */
index 9ac8673d0a23ee46169990ff7daa1208c62a13a0..93a3980cb7f06045bafeaa7b44da5690111ac5b3 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_SURICATA
+
 #include <errno.h>
 
 #include <systemd/sd-json.h>
@@ -195,3 +197,5 @@ const td_source_impl suricata_source = {
        // Methods
        .heartbeat = suricata_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_SURICATA */
index bdf92953fb88b85e54231e0af21380e819424560..484e29717fb31f422be7ac4d48f59b1e0550f06b 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_SURICATA_H
 #define TELEMETRY_SOURCE_SURICATA_H
+#ifdef BUILD_SOURCE_SURICATA
 
 #include "../source.h"
 
 extern const td_source_impl suricata_source;
 
+#endif /* BUILD_SOURCE_SURICATA */
 #endif /* TELEMETRY_SOURCE_SURICATA_H */
index 9cf843827613a8a1a7c6f6e3a036b4686dc90ca1..a78af54f219398770780c430960f1d5d8fdca177 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_UNBOUND
+
 #include <errno.h>
 
 #include "../command.h"
@@ -207,3 +209,5 @@ const td_source_impl unbound_source = {
        // Methods
        .heartbeat = unbound_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_UNBOUND */
index 0d3062c9501ef3b6a20294b43b74710e9f9cc4b0..a816f2ccc1e5d4ad83afe29a8960a9a2bf9d795d 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_UNBOUND_H
 #define TELEMETRY_SOURCE_UNBOUND_H
+#ifdef BUILD_SOURCE_UNBOUND
 
 #include "../source.h"
 
 extern const td_source_impl unbound_source;
 
+#endif /* BUILD_SOURCE_UNBOUND */
 #endif /* TELEMETRY_SOURCE_UNBOUND_H */
index 8e67003393bfb89ca40b77c4b0aa9e5f3faecbe1..70c57f12624297f14f621d66a1e0ab2b2488c29c 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#ifdef BUILD_SOURCE_UPTIME
+
 #include <errno.h>
 #include <sys/sysinfo.h>
 
@@ -51,3 +53,5 @@ const td_source_impl uptime_source = {
        // Methods
        .heartbeat = uptime_heartbeat,
 };
+
+#endif /* BUILD_SOURCE_UPTIME */
index 04ca95b0af0262cb389e64e5099322492da3112f..991f30a8cc9d7a92995a2a4b4f97de389d0a41a7 100644 (file)
 
 #ifndef TELEMETRY_SOURCE_UPTIME_H
 #define TELEMETRY_SOURCE_UPTIME_H
+#ifdef BUILD_SOURCE_UPTIME
 
 #include "../source.h"
 
 extern const td_source_impl uptime_source;
 
+#endif /* BUILD_SOURCE_UPTIME */
 #endif /* TELEMETRY_SOURCE_UPTIME_H */