From: Michael Tremer Date: Mon, 1 Dec 2025 15:04:08 +0000 (+0000) Subject: configure: Add the option to enable/disable sources individually X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad74a21a58ac0b066cdd82edff777fcecbbf8916;p=telemetry.git configure: Add the option to enable/disable sources individually Signed-off-by: Michael Tremer --- diff --git a/configure.ac b/configure.ac index a53b0a6..80a00ce 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..7d84bd3 --- /dev/null +++ b/m4/sources.m4 @@ -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 +]) diff --git a/src/daemon/sources.c b/src/daemon/sources.c index 3c5f2b8..6e7ed62 100644 --- a/src/daemon/sources.c +++ b/src/daemon/sources.c @@ -35,49 +35,23 @@ #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" @@ -87,59 +61,98 @@ // 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 diff --git a/src/daemon/sources/conntrack.c b/src/daemon/sources/conntrack.c index 2cc4bbe..f5c4299 100644 --- a/src/daemon/sources/conntrack.c +++ b/src/daemon/sources/conntrack.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_CONNTRACK + #include #include "../ctx.h" @@ -66,3 +68,5 @@ const td_source_impl conntrack_source = { // Methods .heartbeat = conntrack_heartbeat, }; + +#endif /* BUILD_SOURCE_CONNTRACK */ diff --git a/src/daemon/sources/conntrack.h b/src/daemon/sources/conntrack.h index 40608f1..836e2f3 100644 --- a/src/daemon/sources/conntrack.h +++ b/src/daemon/sources/conntrack.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/contextswitches.c b/src/daemon/sources/contextswitches.c index 92a5122..96df861 100644 --- a/src/daemon/sources/contextswitches.c +++ b/src/daemon/sources/contextswitches.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_CONTEXTSWITCHES + #include #include #include @@ -133,3 +135,5 @@ const td_source_impl contextswitches_source = { .free = contextswitches_free, .heartbeat = contextswitches_heartbeat, }; + +#endif /* BUILD_SOURCE_CONTEXTSWITCHES */ diff --git a/src/daemon/sources/contextswitches.h b/src/daemon/sources/contextswitches.h index 0b10c9f..54622fb 100644 --- a/src/daemon/sources/contextswitches.h +++ b/src/daemon/sources/contextswitches.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/cpufreq.c b/src/daemon/sources/cpufreq.c index 94cd99d..22a0691 100644 --- a/src/daemon/sources/cpufreq.c +++ b/src/daemon/sources/cpufreq.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_CPUFREQ + #include #include #include @@ -117,3 +119,5 @@ const td_source_impl cpufreq_source = { // Methods .heartbeat = cpufreq_heartbeat, }; + +#endif /* BUILD_SOURCE_CPUFREQ */ diff --git a/src/daemon/sources/cpufreq.h b/src/daemon/sources/cpufreq.h index 7bb61f7..284d747 100644 --- a/src/daemon/sources/cpufreq.h +++ b/src/daemon/sources/cpufreq.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/df.c b/src/daemon/sources/df.c index d57b5f9..24a4538 100644 --- a/src/daemon/sources/df.c +++ b/src/daemon/sources/df.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_DF + #include #include #include @@ -101,3 +103,5 @@ const td_source_impl df_source = { // Methods .heartbeat = df_heartbeat, }; + +#endif /* BUILD_SOURCE_DF */ diff --git a/src/daemon/sources/df.h b/src/daemon/sources/df.h index 3d386e1..2036f53 100644 --- a/src/daemon/sources/df.h +++ b/src/daemon/sources/df.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/disk.c b/src/daemon/sources/disk.c index 945cf13..3c1d789 100644 --- a/src/daemon/sources/disk.c +++ b/src/daemon/sources/disk.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_DISK + #include #include @@ -485,3 +487,5 @@ const td_source_impl disk_source = { // Methods .heartbeat = disk_heartbeat, }; + +#endif /* BUILD_SOURCE_DISK */ diff --git a/src/daemon/sources/disk.h b/src/daemon/sources/disk.h index 65d03c0..12af0ac 100644 --- a/src/daemon/sources/disk.h +++ b/src/daemon/sources/disk.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/hostapd.c b/src/daemon/sources/hostapd.c index aebf055..5cad5cf 100644 --- a/src/daemon/sources/hostapd.c +++ b/src/daemon/sources/hostapd.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_HOSTAPD + #include #include #include @@ -256,3 +258,5 @@ const td_source_impl hostapd_source = { // Methods .heartbeat = hostapd_heartbeat, }; + +#endif /* BUILD_SOURCE_HOSTAPD */ diff --git a/src/daemon/sources/hostapd.h b/src/daemon/sources/hostapd.h index c476388..3416ecc 100644 --- a/src/daemon/sources/hostapd.h +++ b/src/daemon/sources/hostapd.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/interfaces.c b/src/daemon/sources/interfaces.c index a218313..2222c28 100644 --- a/src/daemon/sources/interfaces.c +++ b/src/daemon/sources/interfaces.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_INTERFACES + #include #include @@ -232,3 +234,5 @@ const td_source_impl interfaces_source = { // Methods .heartbeat = interfaces_heartbeat, }; + +#endif /* BUILD_SOURCE_INTERFACES */ diff --git a/src/daemon/sources/interfaces.h b/src/daemon/sources/interfaces.h index 754679b..1c1856b 100644 --- a/src/daemon/sources/interfaces.h +++ b/src/daemon/sources/interfaces.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/ipfrag4.c b/src/daemon/sources/ipfrag4.c index e1a3e3a..c4a6e42 100644 --- a/src/daemon/sources/ipfrag4.c +++ b/src/daemon/sources/ipfrag4.c @@ -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 */ diff --git a/src/daemon/sources/ipfrag4.h b/src/daemon/sources/ipfrag4.h index cc0d05b..e42a01a 100644 --- a/src/daemon/sources/ipfrag4.h +++ b/src/daemon/sources/ipfrag4.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/iptables.c b/src/daemon/sources/iptables.c index 19fcc10..81f5560 100644 --- a/src/daemon/sources/iptables.c +++ b/src/daemon/sources/iptables.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_IPTABLES + #include #include @@ -248,3 +250,5 @@ const td_source_impl iptables_source = { // Methods .heartbeat = iptables_heartbeat, }; + +#endif /* BUILD_SOURCE_IPTABLES */ diff --git a/src/daemon/sources/iptables.h b/src/daemon/sources/iptables.h index 5854451..c0cde65 100644 --- a/src/daemon/sources/iptables.h +++ b/src/daemon/sources/iptables.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/legacy-gateway-latency4.c b/src/daemon/sources/legacy-gateway-latency4.c index 2040d48..72321b9 100644 --- a/src/daemon/sources/legacy-gateway-latency4.c +++ b/src/daemon/sources/legacy-gateway-latency4.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4 + #include #include #include @@ -236,3 +238,5 @@ const td_source_impl legacy_gateway_latency4_source = { // Methods .heartbeat = legacy_gateway_latency4_heartbeat, }; + +#endif /* BUILD_SOURCE_LEGACY_GATEWAY_LATENCY4 */ diff --git a/src/daemon/sources/legacy-gateway-latency4.h b/src/daemon/sources/legacy-gateway-latency4.h index 0b14dca..6b2f3e7 100644 --- a/src/daemon/sources/legacy-gateway-latency4.h +++ b/src/daemon/sources/legacy-gateway-latency4.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/loadavg.c b/src/daemon/sources/loadavg.c index c506234..de8674f 100644 --- a/src/daemon/sources/loadavg.c +++ b/src/daemon/sources/loadavg.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_LOADAVG + #include #include "../ctx.h" @@ -55,3 +57,5 @@ const td_source_impl loadavg_source = { // Methods .heartbeat = loadavg_heartbeat, }; + +#endif /* BUILD_SOURCE_LOADAVG */ diff --git a/src/daemon/sources/loadavg.h b/src/daemon/sources/loadavg.h index f604416..8d32cca 100644 --- a/src/daemon/sources/loadavg.h +++ b/src/daemon/sources/loadavg.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/memory.c b/src/daemon/sources/memory.c index 85f6630..f9868fd 100644 --- a/src/daemon/sources/memory.c +++ b/src/daemon/sources/memory.c @@ -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 */ diff --git a/src/daemon/sources/memory.h b/src/daemon/sources/memory.h index 0a9ca1a..bfe02c2 100644 --- a/src/daemon/sources/memory.h +++ b/src/daemon/sources/memory.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/nftables.c b/src/daemon/sources/nftables.c index aabfe53..21d519d 100644 --- a/src/daemon/sources/nftables.c +++ b/src/daemon/sources/nftables.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_NFTABLES + #include #include @@ -385,3 +387,5 @@ const td_source_impl nftables_source = { .free = nftables_free, .heartbeat = nftables_heartbeat, }; + +#endif /* BUILD_SOURCE_NFTABLES */ diff --git a/src/daemon/sources/nftables.h b/src/daemon/sources/nftables.h index 2555fc7..d2ce818 100644 --- a/src/daemon/sources/nftables.h +++ b/src/daemon/sources/nftables.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/pressure-cpu.c b/src/daemon/sources/pressure-cpu.c index 1144392..f8ccef7 100644 --- a/src/daemon/sources/pressure-cpu.c +++ b/src/daemon/sources/pressure-cpu.c @@ -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 */ diff --git a/src/daemon/sources/pressure-cpu.h b/src/daemon/sources/pressure-cpu.h index ef61544..556cf81 100644 --- a/src/daemon/sources/pressure-cpu.h +++ b/src/daemon/sources/pressure-cpu.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/pressure-io.c b/src/daemon/sources/pressure-io.c index 1734d47..27519a8 100644 --- a/src/daemon/sources/pressure-io.c +++ b/src/daemon/sources/pressure-io.c @@ -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 */ diff --git a/src/daemon/sources/pressure-io.h b/src/daemon/sources/pressure-io.h index 8591182..7c32ffe 100644 --- a/src/daemon/sources/pressure-io.h +++ b/src/daemon/sources/pressure-io.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/pressure-memory.c b/src/daemon/sources/pressure-memory.c index f1f4a58..89f812b 100644 --- a/src/daemon/sources/pressure-memory.c +++ b/src/daemon/sources/pressure-memory.c @@ -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 */ diff --git a/src/daemon/sources/pressure-memory.h b/src/daemon/sources/pressure-memory.h index 3448c40..13bbfa2 100644 --- a/src/daemon/sources/pressure-memory.h +++ b/src/daemon/sources/pressure-memory.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/processor.c b/src/daemon/sources/processor.c index f5d7012..bc565ac 100644 --- a/src/daemon/sources/processor.c +++ b/src/daemon/sources/processor.c @@ -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 */ diff --git a/src/daemon/sources/processor.h b/src/daemon/sources/processor.h index 35b3e80..0d93ce4 100644 --- a/src/daemon/sources/processor.h +++ b/src/daemon/sources/processor.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/sensors.c b/src/daemon/sources/sensors.c index 0b093b6..be3483b 100644 --- a/src/daemon/sources/sensors.c +++ b/src/daemon/sources/sensors.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_SENSORS + #include #include @@ -524,3 +526,5 @@ const td_source_impl sensors_current_source = { // Methods .heartbeat = sensors_current_heartbeat, }; + +#endif /* BUILD_SOURCE_SENSORS */ diff --git a/src/daemon/sources/sensors.h b/src/daemon/sources/sensors.h index 1223c8d..9996d37 100644 --- a/src/daemon/sources/sensors.h +++ b/src/daemon/sources/sensors.h @@ -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 */ diff --git a/src/daemon/sources/softirq.c b/src/daemon/sources/softirq.c index ad8b2fc..84c8041 100644 --- a/src/daemon/sources/softirq.c +++ b/src/daemon/sources/softirq.c @@ -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 */ diff --git a/src/daemon/sources/softirq.h b/src/daemon/sources/softirq.h index 3de2412..23b6ba0 100644 --- a/src/daemon/sources/softirq.h +++ b/src/daemon/sources/softirq.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/suricata.c b/src/daemon/sources/suricata.c index 9ac8673..93a3980 100644 --- a/src/daemon/sources/suricata.c +++ b/src/daemon/sources/suricata.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_SURICATA + #include #include @@ -195,3 +197,5 @@ const td_source_impl suricata_source = { // Methods .heartbeat = suricata_heartbeat, }; + +#endif /* BUILD_SOURCE_SURICATA */ diff --git a/src/daemon/sources/suricata.h b/src/daemon/sources/suricata.h index bdf9295..484e297 100644 --- a/src/daemon/sources/suricata.h +++ b/src/daemon/sources/suricata.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/unbound.c b/src/daemon/sources/unbound.c index 9cf8438..a78af54 100644 --- a/src/daemon/sources/unbound.c +++ b/src/daemon/sources/unbound.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_UNBOUND + #include #include "../command.h" @@ -207,3 +209,5 @@ const td_source_impl unbound_source = { // Methods .heartbeat = unbound_heartbeat, }; + +#endif /* BUILD_SOURCE_UNBOUND */ diff --git a/src/daemon/sources/unbound.h b/src/daemon/sources/unbound.h index 0d3062c..a816f2c 100644 --- a/src/daemon/sources/unbound.h +++ b/src/daemon/sources/unbound.h @@ -20,9 +20,11 @@ #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 */ diff --git a/src/daemon/sources/uptime.c b/src/daemon/sources/uptime.c index 8e67003..70c57f1 100644 --- a/src/daemon/sources/uptime.c +++ b/src/daemon/sources/uptime.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#ifdef BUILD_SOURCE_UPTIME + #include #include @@ -51,3 +53,5 @@ const td_source_impl uptime_source = { // Methods .heartbeat = uptime_heartbeat, }; + +#endif /* BUILD_SOURCE_UPTIME */ diff --git a/src/daemon/sources/uptime.h b/src/daemon/sources/uptime.h index 04ca95b..991f30a 100644 --- a/src/daemon/sources/uptime.h +++ b/src/daemon/sources/uptime.h @@ -20,9 +20,11 @@ #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 */