From e3103bdb6ee8bfe1015da37a3f6cb4b697779e6c Mon Sep 17 00:00:00 2001
From: Lars Kruse <devel@sumpfralle.de>
Date: Sat, 8 Feb 2020 23:16:21 +0100
Subject: [PATCH] Plugin df: ignore read-only and virtual filesystem types

The set of filesystems is based on the list of excluded filesystems in
munin's "df" plugin for Linux.
---
 plugins/df | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/df b/plugins/df
index 62c4f5e..e465aef 100644
--- a/plugins/df
+++ b/plugins/df
@@ -1,10 +1,11 @@
 config_df() {
+  IGNORE_FILESYSTEM_REGEX="(none|unknown|rootfs|iso9660|squashfs|udf|romfs|ramfs|debugfs|cgroup_root|devtmpfs)"
   echo "graph_title Filesystem usage (in %)
 graph_args --upper-limit 100 -l 0
 graph_vlabel %
 graph_category disk
 graph_info This graph shows disk usage on the machine."
-  for PART in $(df -P | grep '^/' | sed '/\/[a-z0-9]*$/!d;s/.* \([a-z0-9\/]\{1,\}\)$/\1/g')
+  for PART in $(df -PT | grep '^/' | grep -vwE "$IGNORE_FILESYSTEM_REGEX" | sed '/\/[a-z0-9]*$/!d;s/.* \([a-z0-9\/]\{1,\}\)$/\1/g')
   do
     PINFO=$(df -P "$PART" | tail -1);
     PNAME=$(echo "$PINFO" | cut -d " " -f 1 | sed 's/\//_/g')