]> git.ipfire.org Git - telemetry.git/commitdiff
graphs: unbound: Add a graphs with total queries master
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Dec 2025 18:55:29 +0000 (18:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Dec 2025 18:55:29 +0000 (18:55 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/daemon/graphs.c
src/daemon/graphs/unbound-queries.c [new file with mode: 0644]
src/daemon/graphs/unbound-queries.h [new file with mode: 0644]

index c02dbdd762969f6e03dbeb790e89d7c3571652b2..a188e8184fbd6fde2669401aadb7f8719bfe0bfb 100644 (file)
@@ -154,6 +154,8 @@ dist_telemetryd_SOURCES = \
        src/daemon/graphs/unbound-memory-usage.h \
        src/daemon/graphs/unbound-recursion-time.c \
        src/daemon/graphs/unbound-recursion-time.h \
+       src/daemon/graphs/unbound-queries.c \
+       src/daemon/graphs/unbound-queries.h \
        src/daemon/graphs/uptime.c \
        src/daemon/graphs/uptime.h \
        src/daemon/i18n.h \
index 56bb5763440b0f96fb1d4ea6ca975f3d9e502fbc..902f510f346ee92033c95815e76b925e70c299df 100644 (file)
@@ -45,6 +45,7 @@
 #include "graphs/unbound-cache-usage.h"
 #include "graphs/unbound-memory-usage.h"
 #include "graphs/unbound-recursion-time.h"
+#include "graphs/unbound-queries.h"
 #include "graphs/uptime.h"
 
 // Legacy graphs
@@ -84,6 +85,7 @@ static const td_graph_impl* graph_impls[] = {
        &unbound_cache_usage_graph,
        &unbound_memory_usage_graph,
        &unbound_recursion_time_graph,
+       &unbound_queries_graph,
 
        // Legacy
        &legacy_gateway_latency4_graph,
diff --git a/src/daemon/graphs/unbound-queries.c b/src/daemon/graphs/unbound-queries.c
new file mode 100644 (file)
index 0000000..70c1f81
--- /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-queries.h"
+
+static int unbound_queries_title(td_ctx* ctx, td_graph* graph,
+               const char* object, char* title, size_t length) {
+       return __td_string_set(title, length, _("DNS Queries"));
+}
+
+static int unbound_queries_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_AREA_WITH_LABEL(args, "queries", NULL, COLOR_DEFAULT, 0, _("DNS Queries"));
+       PRINT_CAMM(args, "queries", NULL, QPS);
+
+       return 0;
+}
+
+const td_graph_impl unbound_queries_graph = {
+       .name    = "UnboundQueries",
+       .render  = unbound_queries_render,
+       .title   = unbound_queries_title,
+       .vlabel  = td_graph_vlabel_qps,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
diff --git a/src/daemon/graphs/unbound-queries.h b/src/daemon/graphs/unbound-queries.h
new file mode 100644 (file)
index 0000000..bb3cc7e
--- /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_QUERIES_H
+#define TELEMETRY_GRAPH_UNBOUND_QUERIES_H
+
+#include "../graph.h"
+
+extern const td_graph_impl unbound_queries_graph;
+
+#endif /* TELEMETRY_GRAPH_UNBOUND_QUERIES_H */