--- /dev/null
+/*#############################################################################
+# #
+# collecty - A system statistics collection daemon for IPFire #
+# 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 <string.h>
+
+#include "../ctx.h"
+#include "../module.h"
+#include "../util.h"
+#include "conntrack.h"
+
+static int conntrack_collect(collecty_ctx* ctx, collecty_module* module) {
+ uint64_t count = 0;
+ uint64_t max = 0;
+ int r;
+
+ // Read the total number of connections
+ r = collecty_file_read_uint64("/proc/sys/net/netfilter/nf_conntrack_count", &count);
+ if (r < 0) {
+ ERROR(ctx, "Failed to read %s: %s\n",
+ "/proc/sys/net/netfilter/nf_conntrack_count", strerror(-r));
+ return r;
+ }
+
+ // Read the maximum number of connections
+ r = collecty_file_read_uint64("/proc/sys/net/netfilter/nf_conntrack_max", &max);
+ if (r < 0) {
+ ERROR(ctx, "Failed to read %s: %s\n",
+ "/proc/sys/net/netfilter/nf_conntrack_max", strerror(-r));
+ return r;
+ }
+
+ // Submit the values
+ return collecty_module_submit(module, NULL, "%" PRIu64 ":%" PRIu64, count, max);
+}
+
+const collecty_module_methods conntrack_module = {
+ .name = "conntrack",
+
+ // RRD Data Sources
+ .rrd_dss = {
+ { "count", "GAUGE", 0, -1, },
+ { "max", "GAUGE", 0, -1, },
+ { NULL },
+ },
+
+ // Methods
+ .collect = conntrack_collect,
+};
--- /dev/null
+/*#############################################################################
+# #
+# collecty - A system statistics collection daemon for IPFire #
+# 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 COLLECTY_MODULE_CONNTRACK_H
+#define COLLECTY_MODULE_CONNTRACK_H
+
+#include "../module.h"
+
+extern const collecty_module_methods conntrack_module;
+
+#endif /* COLLECTY_MODULE_CONNTRACK_H */