Skip to content

Commit 27574be

Browse files
authored
fix(diskspace.plugin): exclude ZFS datasets (#21532)
1 parent d9fe0b9 commit 27574be

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/collectors/diskspace.plugin/plugin_diskspace.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,26 @@ static void calculate_values_and_show_charts(
299299
m->collected++;
300300
}
301301
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+
302315
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+
303322
const char *disk = mi->persistent_id;
304323
305324
static SIMPLE_PATTERN *excluded_mountpoints = NULL;

0 commit comments

Comments
 (0)