Posted on 08-15-2014 04:54 PM
Hello all,
I'm looking for a way to monitor the status of non-boot drives, similar to the functionality of the "Boot Drive Percentage Full" criteria. I'm curious if any of you kind folks have come up with a way of handling this, or have any suggestions of how I might go about it.
In the case of file servers with external drives and the like, I'd want to set up a Smart Group that would notify me when their non-boot drives get relatively full to encourage timely housekeeping and upgrades.
Posted on 08-18-2014 05:24 PM
If all the non boot drives have the same name, e.g. 'Media Volume', it should be pretty simple:
#!/bin/bash
#Extension attribute for disk usage in %
USAGE=df -h /Volumes/Media Volume | awk '{print $8}'| grep -v iused |tr -d '%'
echo <result>"$USAGE"</result>
If the non boot volumes don't have the same name across all your machines, things get a bit trickier. You'll have to contend with the possibility of additional volumes showing up that you're not interested in (e.g. a mounted installer, flash drive, etc). If I was tasked with doing this, I would probably get a full list of the disks on the machine, remove the disk currently mounted at / (aka your primary mounted drive), and return the status of the remaining disk that has the largest total storage capacity.