3 """This collects filesystem capacity info using the 'df' command. Tuples of
4 filesystem name and percentage are stored in a list. A simple report is
5 printed. Filesystems over 95% capacity are highlighted. Note that this does not
6 parse filesystem names after the first space, so names with spaces in them will
7 be truncated. This will produce ambiguous results for automount filesystems on
12 child = pexpect.spawn ('df')
14 # parse 'df' output into a list.
15 pattern = "\n(\S+).*?([0-9]+)%"
17 for dummy in range (0, 1000):
18 i = child.expect ([pattern, pexpect.EOF])
20 filesystem_list.append (child.match.groups())
26 for m in filesystem_list:
27 s = "Filesystem %s is at %s%%" % (m[0], m[1])
28 # highlight filesystems over 95% capacity