]> git.ipfire.org Git - telemetry.git/commitdiff
unbound: Check if we have the unbound source available
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jun 2026 15:38:40 +0000 (15:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jun 2026 15:38:40 +0000 (15:38 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/daemon/graphs/unbound-queries.c
src/daemon/graphs/unbound.c [new file with mode: 0644]
src/daemon/graphs/unbound.h [new file with mode: 0644]

index ba161e44440399d37824c999ca40b31ac854cf3b..c1d3cac7588ca1831fe933fb62a73bee793e4e24 100644 (file)
@@ -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 \
index c5b7fcd9fdd4e44c9af96b2166e9c919b613c839..958fe9a54e45d5d4f3a3beda4a3538eeeb9691b5 100644 (file)
@@ -21,6 +21,7 @@
 #include <limits.h>
 
 #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 (file)
index 0000000..84440c8
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#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 (file)
index 0000000..090cac3
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#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 */