Jason
Nice work.
A suggestion, to avoid setting oIFS and then having to clean up again later:
FILESYSTEMS=`mount | egrep -v '[\( ](nobrowse|read-only)[ ,\)]' | sed
's/^.* on \(.*\) (.*)$/\1/'`
echo "[df]"
(IFS=$'\n'
set $FILESYSTEMS
df -PH $1; shift
while test $# -gt 0
do
df -PH $1 | tail -1 | sed 's/\([^ ]\) \([^ ]\)/\1_\2/g'
shift
done) | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'
By moving "IFS=..." and "set $FILESYSTEMS" into the parens, the scope of
the variable change is kept within the parens, thus auto-cleanup.
A second suggestion is to replace the egrep+sed pipeline with a single sed
command, such as:
FILESYSTEMS=`mount | sed '/[\( ](nobrowse|read-only)[ ,\)]/d;s/^.* on
\(.*\) (.*$/\1/'`
This saves an extra process fork/exec. The "/<regexp>/d" operation for sed
will delete matching lines, emulating "egrep -v".
Cheers
Jeremy
On 18 October 2015 at 23:17, Jason White <user-bcd1a66a8ba8@xymon.invalid> wrote:
Greetings,
The following patch fixes these long-standing issues with
xymonclient-darwin.sh:
* Disk usage test erroneously uses inode usage values as Darwin combines
disk usage and inode usage into the same 'df' output by default.
* Mountpoints with spaces in them were not reported.
The former issues is fixed by passing the '-P' flag to 'df' to restore
legacy mode reporting. The latter issue replaces spaces with underscores in
the mountpoint.
In addition to checking mount options for 'nobrowse', this patch also
exclude readonly volumes which I find are mostly transient DMG files.
Regards,
-Jason
--
Jason White
user-bcd1a66a8ba8@xymon.invalid