Allow logical mounts points in the FS plugin (issue #448)

This commit is contained in:
nicolargo 2015-02-08 18:00:35 +01:00
parent e6c646c1e2
commit 0003e0e50a
5 changed files with 28 additions and 4 deletions

7
NEWS
View File

@ -7,12 +7,13 @@ Version 2.4
Enhancements and news features: Enhancements and news features:
* Grab FAN speed in the Glances sensors plugin (issue #501) * Grab FAN speed in the Glances sensors plugin (issue #501)
* Allow logical mounts points in the FS plugin (issue #448)
Bugs corrected: Bugs corrected:
* Correct monitor list, all processes are take into account (issue #507) * Correct monitor list, all processes are take into account (issue #507)
* Correct duplicated --enable-history in the doc (issue #511) * Correct duplicated --enable-history in the doc (issue #511)
Version 2.3 Version 2.3
=========== ===========

View File

@ -101,6 +101,8 @@ careful=50
careful_action=echo {{mnt_point}} {{used}}/{{size}} > /tmp/fs.alert careful_action=echo {{mnt_point}} {{used}}/{{size}} > /tmp/fs.alert
warning=70 warning=70
critical=90 critical=90
# Allow additionnals files types (comma-separated FS type)
allow=zfs
[sensors] [sensors]
# Sensors core limits # Sensors core limits

View File

@ -92,6 +92,8 @@ critical=90
careful=50 careful=50
warning=70 warning=70
critical=90 critical=90
# Allow additionnals files types (comma-separated FS type)
#allow=zfs
[sensors] [sensors]
# Sensors core limits # Sensors core limits

View File

@ -530,6 +530,13 @@ If a RAID controller is detected on you system, its status will be displayed:
.. image:: images/raid.png .. image:: images/raid.png
By default, the plugin only display physical devices only (hard disks, USB keys) and ignore all others. To allow others FS type, you had to use the following section in the configuration file:
::
[fs]
allow=zfs,misc
Sensors Sensors
------- -------

View File

@ -105,6 +105,17 @@ class Plugin(GlancesPlugin):
except UnicodeDecodeError: except UnicodeDecodeError:
return self.stats return self.stats
# Optionnal hack to allow logicals mounts points (issue #448)
# Ex: Had to put 'allow=zfs' in the [fs] section of the conf file
# to allow zfs monitoring
for fstype in self.get_conf_value('allow'):
try:
fs_stat += [f for f in psutil.disk_partitions(all=True) if f.fstype.find(fstype) >= 0]
except UnicodeDecodeError:
return self.stats
logger.info(fs_stat)
# Loop over fs # Loop over fs
for fs in fs_stat: for fs in fs_stat:
fs_current = {} fs_current = {}
@ -182,7 +193,8 @@ class Plugin(GlancesPlugin):
# Add specifics informations # Add specifics informations
# Alert # Alert
for i in self.stats: for i in self.stats:
self.views[i[self.get_key()]]['used']['decoration'] = self.get_alert(i['used'], max=i['size'], header=i['mnt_point']) self.views[i[self.get_key()]]['used']['decoration'] = self.get_alert(
i['used'], max=i['size'], header=i['mnt_point'])
def msg_curse(self, args=None, max_width=None): def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface.""" """Return the dict to display in the curse interface."""