2015-02-22 14:45:57 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-03-08 15:37:56 -04:00
|
|
|
init () {
|
|
|
|
if [ -z $DISK_USAGE_MOUNTPOINT ]; then
|
|
|
|
if is_osx; then
|
|
|
|
DISK_USAGE_MOUNTPOINT="/dev/disk1"
|
|
|
|
else
|
|
|
|
DISK_USAGE_MOUNTPOINT="/dev/vda"
|
|
|
|
fi
|
2015-02-22 14:45:57 -05:00
|
|
|
fi
|
2015-03-08 15:37:56 -04:00
|
|
|
}
|
2015-02-22 14:45:57 -05:00
|
|
|
|
|
|
|
collect () {
|
2015-03-08 07:30:00 -04:00
|
|
|
report $(df | awk -v disk_regexp="^$DISK_USAGE_MOUNTPOINT" \
|
2015-03-11 17:02:00 -04:00
|
|
|
'$0 ~ disk_regexp { printf "%.1f", $5 }')
|
2015-02-22 14:45:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
docs () {
|
|
|
|
echo "Disk usage percentage for a file system at a given mount point."
|
|
|
|
echo "\$DISK_USAGE_MOUNTPOINT=$DISK_USAGE_MOUNTPOINT"
|
|
|
|
}
|