Ignore more non-device related filesystems

The blacklist wasn't really accurate on any recent system anymore
because many more additional filesystems are being implemented these
days (examples: mqueue, binfmt_misc, systemd-1, ...). Instead of
hardcoding all of them, simply ignore all nodev filesystems.

Change-Id: I1fc42ae700475d51e1daf1ed79c6e223532da1d9
This commit is contained in:
Dirk Mueller 2017-04-22 14:19:22 +02:00
parent 96b91896e7
commit 2988905a9f
2 changed files with 12 additions and 4 deletions

View File

@ -23,5 +23,5 @@ instances:
# device_blacklist_re: .*\/dev\/mapper\/lxc-box.*
# For disk metrics it is also possible to ignore entire filesystem types
ignore_filesystem_types: cgroup,configfs,debugfs,devpts,devtmpfs,fusectl,hugetlbfs,proc,pstore,rpc_pipefs,securityfs,sysfs,tmpfs,udevfs,iso9660,nsfs
ignore_filesystem_types: iso9660,tmpfs
device_blacklist_re: .*freezer_backup_snap.*

View File

@ -42,7 +42,7 @@ class Disk(checks.AgentCheck):
send_io_stats = True
send_rollup_stats = False
device_blacklist_re = None
fs_types_to_ignore = []
fs_types_to_ignore = set()
partitions = psutil.disk_partitions(all=True)
if send_io_stats:
@ -120,12 +120,20 @@ class Disk(checks.AgentCheck):
def _get_fs_exclusions(self, instance):
"""parse comma separated file system types to ignore list"""
file_system_list = []
file_system_list = set()
# automatically ignore filesystems not backed by a device
try:
for nodevfs in filter(lambda x: x.startswith('nodev\t'), file('/proc/filesystems')):
file_system_list.add(nodevfs.partition('\t')[2].strip())
except IOError:
log.debug('Failed reading /proc/filesystems')
try:
file_systems = instance.get('ignore_filesystem_types', None)
if file_systems:
# Parse file system types
file_system_list.extend([x.strip() for x in file_systems.split(',')])
file_system_list.update(x.strip() for x in file_systems.split(','))
except ValueError:
log.info("Unable to process ignore_filesystem_types.")