<div dir="ltr">Jason<div><br></div><div>Nice work.</div><div><br></div><div>A suggestion, to avoid setting oIFS and then having to clean up again later:</div><div><br></div><font face="monospace, monospace">FILESYSTEMS=`mount | egrep -v '[\( ](nobrowse|read-only)[ ,\)]' | sed  's/^.* on \(.*\) (.*)$/\1/'`</font><div><font face="monospace, monospace">echo "[df]"<br>(IFS=$'\n'</font></div><div><font face="monospace, monospace">set $FILESYSTEMS<br>df -PH $1; shift<br>while test $# -gt 0<br>do<br>  df -PH $1 | tail -1 | sed 's/\([^ ]\) \([^ ]\)/\1_\2/g'<br>  shift<br>done) | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'</font><div><br></div><div>By moving "IFS=..." and "set $FILESYSTEMS" into the parens, the scope of the variable change is kept within the parens, thus auto-cleanup.</div><div><br></div><div>A second suggestion is to replace the egrep+sed pipeline with a single sed command, such as:</div><div><br></div><div><font face="monospace, monospace">FILESYSTEMS=`mount | sed '/[\( ](nobrowse|read-only)[ ,\)]/d;s/^.* on \(.*\) (.*$/\1/'`</font><br></div><div><br></div><div>This saves an extra process fork/exec.  The "/<regexp>/d" operation for sed will delete matching lines, emulating "egrep -v".</div><div><br></div><div>Cheers</div><div>Jeremy</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 18 October 2015 at 23:17, Jason White <span dir="ltr"><<a href="mailto:jdwhite@menelos.com" target="_blank">jdwhite@menelos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings,<br>
The following patch fixes these long-standing issues with xymonclient-darwin.sh:<br>
<br>
* Disk usage test erroneously uses inode usage values as Darwin combines disk usage and inode usage into the same 'df' output by default.<br>
* Mountpoints with spaces in them were not reported.<br>
<br>
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.<br>
<br>
In addition to checking mount options for 'nobrowse', this patch also exclude readonly volumes which I find are mostly transient DMG files.<br>
<br>
Regards,<br>
-Jason<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Jason White<br>
<a href="mailto:jdwhite@menelos.com">jdwhite@menelos.com</a><br>
<br>
</font></span><br>_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" rel="noreferrer" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
<br></blockquote></div><br></div>