fix(diskspace.plugin): exclude ZFS datasets (#21532)
Ilya Mashchenko committed
Jan 9, 2026 at 21:58 UTC
27574be28a55423b071603d1940ee32edcbdb4be
1 file changed
+19
src/collectors/diskspace.plugin/plugin_diskspace.c
+19
@@ -299,7 +299,26 @@ static void calculate_values_and_show_charts(
299
m->collected++;
300
}
301
302
+// Check if a ZFS filesystem entry is a dataset (not a pool)
303
+static inline bool is_zfs_dataset(struct mountinfo *mi) {
304
+ if(!mi || !mi->filesystem || !mi->mount_source || !mi->mount_source[0])
305
+ return false;
306
+
307
+ if(strcmp(mi->filesystem, "zfs") != 0)
308
+ return false;
309
+
310
+ // For ZFS, the mount_source contains the dataset name (e.g., "tank" or "tank/install")
311
+ // Pools have no slash, datasets have at least one slash
312
+ return strchr(mi->mount_source, '/') != NULL;
313
+}
314
+
315
static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
316
+ // Skip ZFS datasets, only monitor ZFS pools
317
+ // This prevents alert floods when a pool fills up
318
+ if (is_zfs_dataset(mi)) {
319
+ return;
320
+ }
321
+
322
const char *disk = mi->persistent_id;
323
324
static SIMPLE_PATTERN *excluded_mountpoints = NULL;