]> git.ipfire.org Git - collecty.git/commitdiff
graphs: Add a graph for Knot Resolver's queries master
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 May 2026 11:40:22 +0000 (11:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 May 2026 11:40:22 +0000 (11:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/daemon/graphs.c
src/daemon/graphs/knot-resolver-queries.c [new file with mode: 0644]
src/daemon/graphs/knot-resolver-queries.h [new file with mode: 0644]

index 851a354fc27796bb9cef313bf08c4bdc96b47b6b..ba161e44440399d37824c999ca40b31ac854cf3b 100644 (file)
@@ -130,6 +130,8 @@ dist_telemetryd_SOURCES = \
        src/daemon/graphs/interface-throughput.h \
        src/daemon/graphs/interface-packets.c \
        src/daemon/graphs/interface-packets.h \
+       src/daemon/graphs/knot-resolver-queries.c \
+       src/daemon/graphs/knot-resolver-queries.h \
        src/daemon/graphs/legacy-gateway-latency4.c \
        src/daemon/graphs/legacy-gateway-latency4.h \
        src/daemon/graphs/legacy-hostile-drops.c \
index a498b6403af448e2918f03e2bb9e4b7959803d7b..554a9c77075adc693d9e9bacc2df6d56b8b2bea2 100644 (file)
@@ -37,6 +37,7 @@
 #include "graphs/hostapd-station-signal.h"
 #include "graphs/interface-throughput.h"
 #include "graphs/interface-packets.h"
+#include "graphs/knot-resolver-queries.h"
 #include "graphs/loadavg.h"
 #include "graphs/memory.h"
 #include "graphs/pressure.h"
@@ -92,6 +93,9 @@ static const td_graph_impl* graph_impls[] = {
        // Power Consumption
        &processor_power_consumption_graph,
 
+       // Knot Resolver
+       &knot_resolver_queries_graph,
+
        // Unbound
        &unbound_cache_performance_graph,
        &unbound_cache_usage_graph,
diff --git a/src/daemon/graphs/knot-resolver-queries.c b/src/daemon/graphs/knot-resolver-queries.c
new file mode 100644 (file)
index 0000000..cb0971d
--- /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 "knot-resolver-queries.h"
+
+static int knot_resolver_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 knot_resolver_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, "knot-resolver", NULL);
+       if (r < 0)
+               return r;
+
+       // Header
+       PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+       // Draw the average
+       DRAW_AREA_WITH_LABEL(args, "request_total", NULL, COLOR_DEFAULT, 0, _("DNS Queries"));
+       PRINT_CAMM(args, "request_total", NULL, QPS, QPS_UNIT);
+
+       return 0;
+}
+
+const td_graph_impl knot_resolver_queries_graph = {
+       .name    = "KnotResolverQueries",
+       .render  = knot_resolver_queries_render,
+       .title   = knot_resolver_queries_title,
+       .vlabel  = td_graph_vlabel_qps,
+
+       // Limits
+       .lower_limit = 0,
+       .upper_limit = LONG_MAX,
+};
diff --git a/src/daemon/graphs/knot-resolver-queries.h b/src/daemon/graphs/knot-resolver-queries.h
new file mode 100644 (file)
index 0000000..3f96510
--- /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_KNOT_RESOLVER_QUERIES_H
+#define TELEMETRY_GRAPH_KNOT_RESOLVER_QUERIES_H
+
+#include "../graph.h"
+
+extern const td_graph_impl knot_resolver_queries_graph;
+
+#endif /* TELEMETRY_GRAPH_KNOT_RESOLVER_QUERIES_H */