Ignore cifs network mounts (FS starting with //)

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-12-07 18:43:32 +01:00
parent a36d4e0fe2
commit febd8e24ca
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -5,19 +5,20 @@ import sys
CRIT = 90.0 CRIT = 90.0
MOUNT_BLACKLIST = ['/dev', '/efi', '/proc', '/run', '/sys', '/tmp'] MOUNT_BLACKLIST = ['/dev', '/efi', '/proc', '/run', '/sys', '/tmp']
FS_BLACKLIST = ['//', 'cgroup', 'tmpfs']
def main(): def main():
output = subprocess.check_output([ output = subprocess.check_output([
'sh', '-c', 'df -a -B 1 | awk \'{ printf "%s\\t%d\\t%d\\n", $6, $2, $4 }\'' 'sh', '-c', 'df -a -B 1 | awk \'{ printf "%s\\t%d\\t%d\\t%s\\n", $6, $2, $4, $1 }\''
]).decode('utf-8') ]).decode('utf-8')
fs = {} fs = {}
for line in output.split('\n'): for line in output.split('\n'):
if len(line) == 0 or line[0] != '/': if len(line) == 0 or line[0] != '/':
continue continue
(mountpoint, total, available) = line.split('\t') (mountpoint, total, available, filesystem) = line.split('\t')
fs[mountpoint] = (total, available) fs[mountpoint] = (total, available, filesystem)
color = '#50fa7b' color = '#50fa7b'
@ -28,6 +29,10 @@ def main():
if mount.startswith(b): if mount.startswith(b):
skip = True skip = True
for b in FS_BLACKLIST:
if data[2].startswith(b):
skip = True
if skip: if skip:
continue continue