]> git.ipfire.org Git - people/ms/telemetry.git/commitdiff
graphs: Split the Unbound graphs into multiple files
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Dec 2025 13:27:32 +0000 (13:27 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Dec 2025 13:42:03 +0000 (13:42 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 files changed:
Makefile.am
po/POTFILES.in
po/telemetry.pot
src/daemon/graphs.c
src/daemon/graphs/unbound-cache-performance.c [new file with mode: 0644]
src/daemon/graphs/unbound-cache-performance.h [moved from src/daemon/graphs/unbound.h with 85% similarity]
src/daemon/graphs/unbound-cache-usage.c [new file with mode: 0644]
src/daemon/graphs/unbound-cache-usage.h [new file with mode: 0644]
src/daemon/graphs/unbound-memory-usage.c [new file with mode: 0644]
src/daemon/graphs/unbound-memory-usage.h [new file with mode: 0644]
src/daemon/graphs/unbound-recursion-time.c [new file with mode: 0644]
src/daemon/graphs/unbound-recursion-time.h [new file with mode: 0644]
src/daemon/graphs/unbound.c [deleted file]

index 21933db51eaeaac647dc29793a5f21d4305ceaf1..2a2601e5c65516d513b0594c0c46621eb5b63c2c 100644 (file)
@@ -140,8 +140,14 @@ dist_telemetryd_SOURCES = \
        src/daemon/graphs/pressure.h \
        src/daemon/graphs/processor.c \
        src/daemon/graphs/processor.h \
-       src/daemon/graphs/unbound.c \
-       src/daemon/graphs/unbound.h \
+       src/daemon/graphs/unbound-cache-performance.c \
+       src/daemon/graphs/unbound-cache-performance.h \
+       src/daemon/graphs/unbound-cache-usage.c \
+       src/daemon/graphs/unbound-cache-usage.h \
+       src/daemon/graphs/unbound-memory-usage.c \
+       src/daemon/graphs/unbound-memory-usage.h \
+       src/daemon/graphs/unbound-recursion-time.c \
+       src/daemon/graphs/unbound-recursion-time.h \
        src/daemon/graphs/uptime.c \
        src/daemon/graphs/uptime.h \
        src/daemon/i18n.h \
index d230ee242ae875b5913df343ffc35e1f3ef6561f..f6a266b86f44568fc7d016e8974250aa2f3fabae 100644 (file)
@@ -49,8 +49,14 @@ src/daemon/graphs/pressure.c
 src/daemon/graphs/pressure.h
 src/daemon/graphs/processor.c
 src/daemon/graphs/processor.h
-src/daemon/graphs/unbound.c
-src/daemon/graphs/unbound.h
+src/daemon/graphs/unbound-cache-performance.c
+src/daemon/graphs/unbound-cache-performance.h
+src/daemon/graphs/unbound-cache-usage.c
+src/daemon/graphs/unbound-cache-usage.h
+src/daemon/graphs/unbound-memory-usage.c
+src/daemon/graphs/unbound-memory-usage.h
+src/daemon/graphs/unbound-recursion-time.c
+src/daemon/graphs/unbound-recursion-time.h
 src/daemon/graphs/uptime.c
 src/daemon/graphs/uptime.h
 src/daemon/i18n.h
@@ -83,8 +89,8 @@ src/daemon/sources/disk.h
 src/daemon/sources.h
 src/daemon/sources/hostapd.c
 src/daemon/sources/hostapd.h
-src/daemon/sources/interfaces.c
-src/daemon/sources/interfaces.h
+src/daemon/sources/interface.c
+src/daemon/sources/interface.h
 src/daemon/sources/ipfrag4.c
 src/daemon/sources/ipfrag4.h
 src/daemon/sources/iptables.c
index eede03619f60e72213f400e614e0508cb0927ab8..10a33364d5b6c64f9cfb6e81d9b22883bbbf742d 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2025-11-29 12:36+0000\n"
+"POT-Creation-Date: 2025-12-03 13:27+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -151,6 +151,10 @@ msgstr ""
 msgid "Last ACK Signal"
 msgstr ""
 
+#, c-format
+msgid "Throughput - %s"
+msgstr ""
+
 msgid "Latency to the Default Gateway"
 msgstr ""
 
index 3ca2b5427b0cb7bcc5e3ee4d45fb038d24976f7d..5d4901e5722e57ec7e2eb4941ea02f8b71976a9b 100644 (file)
 #include "graphs/memory.h"
 #include "graphs/pressure.h"
 #include "graphs/processor.h"
-#include "graphs/unbound.h"
+#include "graphs/unbound-cache-performance.h"
+#include "graphs/unbound-cache-usage.h"
+#include "graphs/unbound-memory-usage.h"
+#include "graphs/unbound-recursion-time.h"
 #include "graphs/uptime.h"
 
 // Legacy graphs
diff --git a/src/daemon/graphs/unbound-cache-performance.c b/src/daemon/graphs/unbound-cache-performance.c
new file mode 100644 (file)
index 0000000..b0bf55f
--- /dev/null
@@ -0,0 +1,78 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <limits.h>
+
+#include "graph.h"
+#include "unbound-cache-performance.h"
+
+static int unbound_cache_performance_title(td_ctx* ctx, td_graph* graph,
+               const char* object, char* title, size_t length) {
+       return __td_string_set(title, length, _("DNS Cache Performance"));
+}
+
+static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph,
+               const td_graph_render_options* options, td_args* args, const char* object) {
+       int r;
+
+       // Load all sources
+       r = td_graph_require_source(graph, args, "unbound", NULL);
+       if (r < 0)
+               return r;
+
+       // Header
+       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+       // Show the total queries
+       PRINT_LABEL(args, _("Total"));
+       PRINT_CAMM(args, "queries", NULL, QPS);
+
+       PRINT_EMPTY_LINE(args);
+
+       // Draw the stacked background first
+       DRAW_AREA_BACKGROUND(args, "cachehits", NULL, COLOR_CACHE_HIT, 0);
+       DRAW_AREA_BACKGROUND(args, "cachemiss", NULL, COLOR_CACHE_MISS, STACKED);
+
+       // Draw the area outlines afterwards
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachehits", NULL,
+               COLOR_CACHE_HIT, 0, _("Cache Hits"));
+       PRINT_CAMM(args, "cachehits", NULL, QPS);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachemiss", NULL,
+               COLOR_CACHE_MISS, STACKED, _("Cache Miss"));
+       PRINT_CAMM(args, "cachemiss", NULL, QPS);
+
+       DRAW_LINE_WITH_LABEL(args, 1, "prefetch", NULL,
+               COLOR_CACHE_PREFETCH, 0, _("Prefetched Queries"));
+       PRINT_CAMM(args, "prefetch", NULL, QPS);
+
+       return 0;
+}
+
+const td_graph_impl unbound_cache_performance_graph = {
+       .name    = "UnboundCachePerformance",
+       .render  = unbound_cache_performance_render,
+       .title   = unbound_cache_performance_title,
+       .vlabel  = td_graph_vlabel_qps,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
similarity index 85%
rename from src/daemon/graphs/unbound.h
rename to src/daemon/graphs/unbound-cache-performance.h
index 41cdc4163c62c4696a2ebc18ddc5442c7617e13e..5452e3ec962f271ccb8724d80e88367356a8ccbc 100644 (file)
 #                                                                             #
 #############################################################################*/
 
-#ifndef TELEMETRY_GRAPH_UNBOUND_H
-#define TELEMETRY_GRAPH_UNBOUND_H
+#ifndef TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H
+#define TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H
 
 #include "../graph.h"
 
 extern const td_graph_impl unbound_cache_performance_graph;
-extern const td_graph_impl unbound_cache_usage_graph;
-extern const td_graph_impl unbound_memory_usage_graph;
-extern const td_graph_impl unbound_recursion_time_graph;
 
-#endif /* TELEMETRY_GRAPH_UNBOUND_H */
+#endif /* TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H */
diff --git a/src/daemon/graphs/unbound-cache-usage.c b/src/daemon/graphs/unbound-cache-usage.c
new file mode 100644 (file)
index 0000000..1fcebbf
--- /dev/null
@@ -0,0 +1,83 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <limits.h>
+
+#include "graph.h"
+#include "unbound-cache-usage.h"
+
+static int unbound_cache_usage_title(td_ctx* ctx, td_graph* graph,
+               const char* object, char* title, size_t length) {
+       return __td_string_set(title, length, _("DNS Cache Usage"));
+}
+
+static int unbound_cache_usage_render(td_ctx* ctx, td_graph* graph,
+               const td_graph_render_options* options, td_args* args, const char* object) {
+       int r;
+
+       // Load all sources
+       r = td_graph_require_source(graph, args, "unbound", NULL);
+       if (r < 0)
+               return r;
+
+       // Draw the stacked background first
+       DRAW_AREA_BACKGROUND(args, "cache_key_objects",   NULL, COLOR_DNS_KEYS, 0);
+       DRAW_AREA_BACKGROUND(args, "cache_infra_objects", NULL, COLOR_DNS_INFRA, STACKED);
+       DRAW_AREA_BACKGROUND(args, "cache_rrset_objects", NULL, COLOR_DNS_RRSETS, STACKED);
+       DRAW_AREA_BACKGROUND(args, "cache_msg_objects",   NULL, COLOR_DNS_MSGS, STACKED);
+
+       // Draw the area outlines afterwards
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_key_objects", NULL,
+               COLOR_DNS_KEYS, 0, _("Key Objects"));
+       PRINT_CAMM(args, "cache_key_objects", NULL, LARGE_INTEGER);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_infra_objects", NULL,
+               COLOR_DNS_INFRA, STACKED, _("Infrastructure Objects"));
+       PRINT_CAMM(args, "cache_infra_objects", NULL, LARGE_INTEGER);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_rrset_objects", NULL,
+               COLOR_DNS_RRSETS, STACKED, _("RRSet Objects"));
+       PRINT_CAMM(args, "cache_rrset_objects", NULL, LARGE_INTEGER);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_msg_objects", NULL,
+               COLOR_DNS_MSGS, STACKED, _("Message Objects"));
+       PRINT_CAMM(args, "cache_msg_objects", NULL, LARGE_INTEGER);
+
+       PRINT_EMPTY_LINE(args);
+
+       // Header
+       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+       return 0;
+}
+
+const td_graph_impl unbound_cache_usage_graph = {
+       .name    = "UnboundCacheUsage",
+       .render  = unbound_cache_usage_render,
+       .title   = unbound_cache_usage_title,
+       .vlabel  = td_graph_vlabel_objects,
+
+       // Flags
+       .flags   = TELEMETRY_GRAPH_REVERSE,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
diff --git a/src/daemon/graphs/unbound-cache-usage.h b/src/daemon/graphs/unbound-cache-usage.h
new file mode 100644 (file)
index 0000000..fbbc8ea
--- /dev/null
@@ -0,0 +1,28 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H
+#define TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H
+
+#include "../graph.h"
+
+extern const td_graph_impl unbound_cache_usage_graph;
+
+#endif /* TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H */
diff --git a/src/daemon/graphs/unbound-memory-usage.c b/src/daemon/graphs/unbound-memory-usage.c
new file mode 100644 (file)
index 0000000..7b32c40
--- /dev/null
@@ -0,0 +1,88 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <limits.h>
+
+#include "graph.h"
+#include "unbound-memory-usage.h"
+
+static int unbound_memory_usage_title(td_ctx* ctx, td_graph* graph,
+               const char* object, char* title, size_t length) {
+       return __td_string_set(title, length, _("DNS Memory Usage"));
+}
+
+static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph,
+               const td_graph_render_options* options, td_args* args, const char* object) {
+       int r;
+
+       // Load all sources
+       r = td_graph_require_source(graph, args, "unbound", NULL);
+       if (r < 0)
+               return r;
+
+       // Draw the stacked background first
+       DRAW_AREA_BACKGROUND(args, "mem_mod_respip",    NULL, COLOR_DNS_RPZ, 0);
+       DRAW_AREA_BACKGROUND(args, "mem_mod_validator", NULL, COLOR_DNS_VALIDATOR, STACKED);
+       DRAW_AREA_BACKGROUND(args, "mem_mod_iterator",  NULL, COLOR_DNS_ITERATOR, STACKED);
+       DRAW_AREA_BACKGROUND(args, "mem_cache_rrset",   NULL, COLOR_DNS_RRSETS, STACKED);
+       DRAW_AREA_BACKGROUND(args, "mem_cache_message", NULL, COLOR_DNS_MSGS, STACKED);
+
+       // Draw the area outlines afterwards
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_respip", NULL,
+               COLOR_DNS_RPZ, 0, _("Request Policy Zones"));
+       PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_validator", NULL,
+               COLOR_DNS_VALIDATOR, STACKED, _("Validator"));
+       PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_iterator", NULL,
+               COLOR_DNS_ITERATOR, STACKED, _("Iterator"));
+       PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_rrset", NULL,
+               COLOR_DNS_RRSETS, STACKED, _("RRSet Objects"));
+       PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES);
+
+       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_message", NULL,
+               COLOR_DNS_MSGS, STACKED, _("Message Objects"));
+       PRINT_CAMM(args, "mem_cache_message", NULL, BYTES);
+
+       PRINT_EMPTY_LINE(args);
+
+       // Header
+       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+       return 0;
+}
+
+const td_graph_impl unbound_memory_usage_graph = {
+       .name    = "UnboundMemoryUsage",
+       .render  = unbound_memory_usage_render,
+       .title   = unbound_memory_usage_title,
+       .vlabel  = td_graph_vlabel_bytes,
+
+       // Flags
+       .flags   = TELEMETRY_GRAPH_REVERSE,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
diff --git a/src/daemon/graphs/unbound-memory-usage.h b/src/daemon/graphs/unbound-memory-usage.h
new file mode 100644 (file)
index 0000000..1010b03
--- /dev/null
@@ -0,0 +1,28 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H
+#define TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H
+
+#include "../graph.h"
+
+extern const td_graph_impl unbound_memory_usage_graph;
+
+#endif /* TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H */
diff --git a/src/daemon/graphs/unbound-recursion-time.c b/src/daemon/graphs/unbound-recursion-time.c
new file mode 100644 (file)
index 0000000..cf9671a
--- /dev/null
@@ -0,0 +1,59 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <limits.h>
+
+#include "graph.h"
+#include "unbound-recursion-time.h"
+
+static int unbound_recursion_time_title(td_ctx* ctx, td_graph* graph,
+               const char* object, char* title, size_t length) {
+       return __td_string_set(title, length, _("DNS Recursion Time"));
+}
+
+static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph,
+               const td_graph_render_options* options, td_args* args, const char* object) {
+       int r;
+
+       // Load all sources
+       r = td_graph_require_source(graph, args, "unbound", NULL);
+       if (r < 0)
+               return r;
+
+       // Header
+       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+       // Draw the average
+       DRAW_LINE_WITH_LABEL(args, 1, "rec_time_avg", NULL, COLOR_DEFAULT, 0, _("Recursion Time"));
+       PRINT_CAMM(args, "rec_time_avg", NULL, SECONDS_HIGHRES);
+
+       return 0;
+}
+
+const td_graph_impl unbound_recursion_time_graph = {
+       .name    = "UnboundRecursionTime",
+       .render  = unbound_recursion_time_render,
+       .title   = unbound_recursion_time_title,
+       .vlabel  = td_graph_vlabel_seconds,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
diff --git a/src/daemon/graphs/unbound-recursion-time.h b/src/daemon/graphs/unbound-recursion-time.h
new file mode 100644 (file)
index 0000000..866f03e
--- /dev/null
@@ -0,0 +1,28 @@
+/*#############################################################################
+#                                                                             #
+# telemetryd - The IPFire Telemetry Collection Service                        #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H
+#define TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H
+
+#include "../graph.h"
+
+extern const td_graph_impl unbound_recursion_time_graph;
+
+#endif /* TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H */
diff --git a/src/daemon/graphs/unbound.c b/src/daemon/graphs/unbound.c
deleted file mode 100644 (file)
index ba12feb..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# telemetryd - The IPFire Telemetry Collection Service                        #
-# Copyright (C) 2025 IPFire Development Team                                  #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-#############################################################################*/
-
-#include <limits.h>
-
-#include "graph.h"
-#include "unbound.h"
-
-static int unbound_cache_performance_title(td_ctx* ctx, td_graph* graph,
-               const char* object, char* title, size_t length) {
-       return __td_string_set(title, length, _("DNS Cache Performance"));
-}
-
-static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph,
-               const td_graph_render_options* options, td_args* args, const char* object) {
-       int r;
-
-       // Load all sources
-       r = td_graph_require_source(graph, args, "unbound", NULL);
-       if (r < 0)
-               return r;
-
-       // Header
-       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
-
-       // Show the total queries
-       PRINT_LABEL(args, _("Total"));
-       PRINT_CAMM(args, "queries", NULL, QPS);
-
-       PRINT_EMPTY_LINE(args);
-
-       // Draw the stacked background first
-       DRAW_AREA_BACKGROUND(args, "cachehits", NULL, COLOR_CACHE_HIT, 0);
-       DRAW_AREA_BACKGROUND(args, "cachemiss", NULL, COLOR_CACHE_MISS, STACKED);
-
-       // Draw the area outlines afterwards
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachehits", NULL,
-               COLOR_CACHE_HIT, 0, _("Cache Hits"));
-       PRINT_CAMM(args, "cachehits", NULL, QPS);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachemiss", NULL,
-               COLOR_CACHE_MISS, STACKED, _("Cache Miss"));
-       PRINT_CAMM(args, "cachemiss", NULL, QPS);
-
-       DRAW_LINE_WITH_LABEL(args, 1, "prefetch", NULL,
-               COLOR_CACHE_PREFETCH, 0, _("Prefetched Queries"));
-       PRINT_CAMM(args, "prefetch", NULL, QPS);
-
-       return 0;
-}
-
-const td_graph_impl unbound_cache_performance_graph = {
-       .name    = "UnboundCachePerformance",
-       .render  = unbound_cache_performance_render,
-       .title   = unbound_cache_performance_title,
-       .vlabel  = td_graph_vlabel_qps,
-
-       // Limits
-       .lower_limit = 0,
-       .upper_limit = LONG_MAX,
-};
-
-static int unbound_cache_usage_title(td_ctx* ctx, td_graph* graph,
-               const char* object, char* title, size_t length) {
-       return __td_string_set(title, length, _("DNS Cache Usage"));
-}
-
-static int unbound_cache_usage_render(td_ctx* ctx, td_graph* graph,
-               const td_graph_render_options* options, td_args* args, const char* object) {
-       int r;
-
-       // Load all sources
-       r = td_graph_require_source(graph, args, "unbound", NULL);
-       if (r < 0)
-               return r;
-
-       // Draw the stacked background first
-       DRAW_AREA_BACKGROUND(args, "cache_key_objects",   NULL, COLOR_DNS_KEYS, 0);
-       DRAW_AREA_BACKGROUND(args, "cache_infra_objects", NULL, COLOR_DNS_INFRA, STACKED);
-       DRAW_AREA_BACKGROUND(args, "cache_rrset_objects", NULL, COLOR_DNS_RRSETS, STACKED);
-       DRAW_AREA_BACKGROUND(args, "cache_msg_objects",   NULL, COLOR_DNS_MSGS, STACKED);
-
-       // Draw the area outlines afterwards
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_key_objects", NULL,
-               COLOR_DNS_KEYS, 0, _("Key Objects"));
-       PRINT_CAMM(args, "cache_key_objects", NULL, LARGE_INTEGER);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_infra_objects", NULL,
-               COLOR_DNS_INFRA, STACKED, _("Infrastructure Objects"));
-       PRINT_CAMM(args, "cache_infra_objects", NULL, LARGE_INTEGER);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_rrset_objects", NULL,
-               COLOR_DNS_RRSETS, STACKED, _("RRSet Objects"));
-       PRINT_CAMM(args, "cache_rrset_objects", NULL, LARGE_INTEGER);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_msg_objects", NULL,
-               COLOR_DNS_MSGS, STACKED, _("Message Objects"));
-       PRINT_CAMM(args, "cache_msg_objects", NULL, LARGE_INTEGER);
-
-       PRINT_EMPTY_LINE(args);
-
-       // Header
-       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
-
-       return 0;
-}
-
-const td_graph_impl unbound_cache_usage_graph = {
-       .name    = "UnboundCacheUsage",
-       .render  = unbound_cache_usage_render,
-       .title   = unbound_cache_usage_title,
-       .vlabel  = td_graph_vlabel_objects,
-
-       // Flags
-       .flags   = TELEMETRY_GRAPH_REVERSE,
-
-       // Limits
-       .lower_limit = 0,
-       .upper_limit = LONG_MAX,
-};
-
-static int unbound_memory_usage_title(td_ctx* ctx, td_graph* graph,
-               const char* object, char* title, size_t length) {
-       return __td_string_set(title, length, _("DNS Memory Usage"));
-}
-
-static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph,
-               const td_graph_render_options* options, td_args* args, const char* object) {
-       int r;
-
-       // Load all sources
-       r = td_graph_require_source(graph, args, "unbound", NULL);
-       if (r < 0)
-               return r;
-
-       // Draw the stacked background first
-       DRAW_AREA_BACKGROUND(args, "mem_mod_respip",    NULL, COLOR_DNS_RPZ, 0);
-       DRAW_AREA_BACKGROUND(args, "mem_mod_validator", NULL, COLOR_DNS_VALIDATOR, STACKED);
-       DRAW_AREA_BACKGROUND(args, "mem_mod_iterator",  NULL, COLOR_DNS_ITERATOR, STACKED);
-       DRAW_AREA_BACKGROUND(args, "mem_cache_rrset",   NULL, COLOR_DNS_RRSETS, STACKED);
-       DRAW_AREA_BACKGROUND(args, "mem_cache_message", NULL, COLOR_DNS_MSGS, STACKED);
-
-       // Draw the area outlines afterwards
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_respip", NULL,
-               COLOR_DNS_RPZ, 0, _("Request Policy Zones"));
-       PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_validator", NULL,
-               COLOR_DNS_VALIDATOR, STACKED, _("Validator"));
-       PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_iterator", NULL,
-               COLOR_DNS_ITERATOR, STACKED, _("Iterator"));
-       PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_rrset", NULL,
-               COLOR_DNS_RRSETS, STACKED, _("RRSet Objects"));
-       PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES);
-
-       DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_message", NULL,
-               COLOR_DNS_MSGS, STACKED, _("Message Objects"));
-       PRINT_CAMM(args, "mem_cache_message", NULL, BYTES);
-
-       PRINT_EMPTY_LINE(args);
-
-       // Header
-       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
-
-       return 0;
-}
-
-const td_graph_impl unbound_memory_usage_graph = {
-       .name    = "UnboundMemoryUsage",
-       .render  = unbound_memory_usage_render,
-       .title   = unbound_memory_usage_title,
-       .vlabel  = td_graph_vlabel_bytes,
-
-       // Flags
-       .flags   = TELEMETRY_GRAPH_REVERSE,
-
-       // Limits
-       .lower_limit = 0,
-       .upper_limit = LONG_MAX,
-};
-
-static int unbound_recursion_time_title(td_ctx* ctx, td_graph* graph,
-               const char* object, char* title, size_t length) {
-       return __td_string_set(title, length, _("DNS Recursion Time"));
-}
-
-static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph,
-               const td_graph_render_options* options, td_args* args, const char* object) {
-       int r;
-
-       // Load all sources
-       r = td_graph_require_source(graph, args, "unbound", NULL);
-       if (r < 0)
-               return r;
-
-       // Header
-       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
-
-       // Draw the average
-       DRAW_LINE_WITH_LABEL(args, 1, "rec_time_avg", NULL, COLOR_DEFAULT, 0, _("Recursion Time"));
-       PRINT_CAMM(args, "rec_time_avg", NULL, SECONDS_HIGHRES);
-
-       return 0;
-}
-
-const td_graph_impl unbound_recursion_time_graph = {
-       .name    = "UnboundRecursionTime",
-       .render  = unbound_recursion_time_render,
-       .title   = unbound_recursion_time_title,
-       .vlabel  = td_graph_vlabel_seconds,
-
-       // Limits
-       .lower_limit = 0,
-       .upper_limit = LONG_MAX,
-};