--- /dev/null
+/*#############################################################################
+# #
+# 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 "legacy-suricata.h"
+
+#define COLOR_WHITELISTED GREEN
+#define COLOR_BYPASSED ORANGE
+#define COLOR_SCANNED RED
+
+static int legacy_suricata_title(td_ctx* ctx, td_graph* graph,
+ const char* object, char* title, size_t length) {
+ return __td_string_set(title, length, _("Suricata Throughput"));
+}
+
+static int legacy_suricata_vlabel(td_ctx* ctx, td_graph* graph,
+ const char* object, char* vlabel, size_t length) {
+ return __td_string_set(vlabel, length, _("bps"));
+}
+
+static int legacy_suricata_render(td_ctx* ctx,
+ td_graph* graph, td_args* args, const char* object) {
+ int r;
+
+ const char* chains[] = {
+ "SCANNED",
+ "BYPASSED",
+ "WHITELISTED",
+ NULL,
+ };
+
+ // Load all sources
+ r = td_graph_require_sources(graph, args, "iptables", chains);
+ if (r < 0)
+ return r;
+
+ // Convert everything into bps
+ COMPUTE_BITS(args, "bps", "WHITELISTED", "bytes");
+ COMPUTE_BITS(args, "bps", "BYPASSED", "bytes");
+ COMPUTE_BITS(args, "bps", "SCANNED", "bytes");
+
+ // Add up all packets
+ COMPUTE_CDEF(args,
+ "total=" FIELD "," FIELD ",ADDNAN," FIELD ",ADDNAN",
+ FIELD_AND_OBJECT("bps", "WHITELISTED"),
+ FIELD_AND_OBJECT("bps", "BYPASSED"),
+ FIELD_AND_OBJECT("bps", "SCANNED")
+ );
+ VALUE_ALL(args, "total", NULL);
+
+ // Draw the stacked background first
+ DRAW_AREA_BACKGROUND(args, "bps", "WHITELISTED", COLOR_WHITELISTED, 0);
+ DRAW_AREA_BACKGROUND(args, "bps", "BYPASSED", COLOR_BYPASSED, STACKED);
+ DRAW_AREA_BACKGROUND(args, "bps", "SCANNED", COLOR_SCANNED, STACKED);
+
+ // Draw the area outlines afterwards
+ DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "WHITELISTED", COLOR_WHITELISTED,
+ 0, _("Whitelisted"));
+ PRINT_CAMM(args, "bps", "WHITELISTED", BPS);
+
+ DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "BYPASSED", COLOR_BYPASSED,
+ 0, _("Offloaded"));
+ PRINT_CAMM(args, "bps", "BYPASSED", BPS);
+
+ DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "SCANNED", COLOR_SCANNED,
+ 0, _("Scanned"));
+ PRINT_CAMM(args, "bps", "SCANNED", BPS);
+
+ PRINT_EMPTY_LINE(args);
+
+ // Show the total throughput
+ PRINT_LABEL(args, _("Total"));
+ PRINT_CAMM(args, "total", NULL, BPS);
+
+ // Header
+ PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
+
+ return 0;
+}
+
+const td_graph_impl legacy_suricata_graph = {
+ .name = "LegacySuricata",
+ .render = legacy_suricata_render,
+ .title = legacy_suricata_title,
+ .vlabel = legacy_suricata_vlabel,
+
+ // Flags
+ .flags = TELEMETRY_GRAPH_REVERSE,
+
+ // Limits
+ .lower_limit = 0,
+ .upper_limit = LONG_MAX,
+};
--- /dev/null
+/*#############################################################################
+# #
+# 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_LEGACY_SURICATA_H
+#define TELEMETRY_GRAPH_LEGACY_SURICATA_H
+
+#include "../graph.h"
+
+extern const td_graph_impl legacy_suricata_graph;
+
+#endif /* TELEMETRY_GRAPH_LEGACY_SURICATA_H */