From: Michael Tremer Date: Thu, 4 Dec 2025 18:55:29 +0000 (+0000) Subject: graphs: unbound: Add a graphs with total queries X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00b4fd6e254508cf958fa0144d2e2722a93b479d;p=telemetry.git graphs: unbound: Add a graphs with total queries Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index c02dbdd..a188e81 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/src/daemon/graphs.c b/src/daemon/graphs.c index 56bb576..902f510 100644 --- a/src/daemon/graphs.c +++ b/src/daemon/graphs.c @@ -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 index 0000000..70c1f81 --- /dev/null +++ b/src/daemon/graphs/unbound-queries.c @@ -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 . # +# # +#############################################################################*/ + +#include + +#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 index 0000000..bb3cc7e --- /dev/null +++ b/src/daemon/graphs/unbound-queries.h @@ -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 . # +# # +#############################################################################*/ + +#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 */