summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2020-02-27 13:56:06 +0100
committernicolargo <nicolashennion@gmail.com>2020-02-27 13:56:06 +0100
commit76c8492832a5f234d4a2c41c20482336231845f8 (patch)
tree498f66281d292c0c4f68fe2d933e9edc43814468
parent0cdf91ba53aecd8322134484e73ecd5bb0daa9f0 (diff)
FS filtering can be done on device name #1606
-rw-r--r--docs/aoa/fs.rst9
-rw-r--r--glances/plugins/glances_fs.py15
2 files changed, 20 insertions, 4 deletions
diff --git a/docs/aoa/fs.rst b/docs/aoa/fs.rst
index 923c97f3..38c56097 100644
--- a/docs/aoa/fs.rst
+++ b/docs/aoa/fs.rst
@@ -37,10 +37,17 @@ system:
Also, you can hide mount points as well (in the following ``/boot``):
+
+.. code-block:: ini
+
+[fs]
+hide=/boot.*
+Filtering can also be done on device name (Glances 3.1.4 or higher):
+
.. code-block:: ini
[fs]
- hide=/boot.*
+ hide=/dev/sdb2
RAID
----
diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py
index 37a125d6..bc0a981d 100644
--- a/glances/plugins/glances_fs.py
+++ b/glances/plugins/glances_fs.py
@@ -114,7 +114,8 @@ class Plugin(GlancesPlugin):
# Loop over fs
for fs in fs_stat:
# Do not take hidden file system into account
- if self.is_hide(fs.mountpoint):
+ # Also check device name (see issue #1606)
+ if self.is_hide(fs.mountpoint) or self.is_hide(fs.device):
continue
# Grab the disk usage
try:
@@ -163,7 +164,11 @@ class Plugin(GlancesPlugin):
'used': used,
'percent': percent,
'key': self.get_key()}
- stats.append(fs_current)
+ # Do not take hidden file system into account
+ if self.is_hide(fs_current['mnt_point']):
+ continue
+ else:
+ stats.append(fs_current)
else:
# Default behavior
for fs in fs_stat:
@@ -174,7 +179,11 @@ class Plugin(GlancesPlugin):
'used': int(fs_stat[fs]['used']) * 1024,
'percent': float(fs_stat[fs]['percent']),
'key': self.get_key()}
- stats.append(fs_current)
+ # Do not take hidden file system into account
+ if self.is_hide(fs_current['mnt_point']) or self.is_hide(fs_current['device_name']):
+ continue
+ else:
+ stats.append(fs_current)
# Update the stats
self.stats = stats