From: Michael Tremer Date: Fri, 5 Jun 2026 15:38:40 +0000 (+0000) Subject: unbound: Check if we have the unbound source available X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69ccf6f99bf5475e3388041381b0eff3ed4f5316;p=telemetry.git unbound: Check if we have the unbound source available Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index ba161e4..c1d3cac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -164,6 +164,8 @@ dist_telemetryd_SOURCES = \ src/daemon/graphs/unbound-recursion-time.h \ src/daemon/graphs/unbound-queries.c \ src/daemon/graphs/unbound-queries.h \ + src/daemon/graphs/unbound.c \ + src/daemon/graphs/unbound.h \ src/daemon/graphs/uptime.c \ src/daemon/graphs/uptime.h \ src/daemon/i18n.h \ diff --git a/src/daemon/graphs/unbound-queries.c b/src/daemon/graphs/unbound-queries.c index c5b7fcd..958fe9a 100644 --- a/src/daemon/graphs/unbound-queries.c +++ b/src/daemon/graphs/unbound-queries.c @@ -21,6 +21,7 @@ #include #include "graph.h" +#include "unbound.h" #include "unbound-queries.h" static int unbound_queries_title(td_ctx* ctx, td_graph* graph, @@ -48,10 +49,11 @@ static int unbound_queries_render(td_ctx* ctx, td_graph* graph, } const td_graph_impl unbound_queries_graph = { - .name = "UnboundQueries", - .render = unbound_queries_render, - .title = unbound_queries_title, - .vlabel = td_graph_vlabel_qps, + .name = "UnboundQueries", + .can_render = unbound_can_render, + .render = unbound_queries_render, + .title = unbound_queries_title, + .vlabel = td_graph_vlabel_qps, // Limits .lower_limit = 0, diff --git a/src/daemon/graphs/unbound.c b/src/daemon/graphs/unbound.c new file mode 100644 index 0000000..84440c8 --- /dev/null +++ b/src/daemon/graphs/unbound.c @@ -0,0 +1,29 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2026 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 "unbound.h" + +#include "../ctx.h" +#include "../graph.h" + +int unbound_can_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, const char* object) { + return td_graph_requires_source(graph, "unbound", NULL); +} diff --git a/src/daemon/graphs/unbound.h b/src/daemon/graphs/unbound.h new file mode 100644 index 0000000..090cac3 --- /dev/null +++ b/src/daemon/graphs/unbound.h @@ -0,0 +1,30 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2026 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_H +#define TELEMETRY_GRAPH_UNBOUND_H + +#include "../ctx.h" +#include "../graph.h" + +int unbound_can_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, const char* object); + +#endif /* TELEMETRY_GRAPH_UNBOUND_H */