Running out of space on OS X is bad, like real bad.
Read on to find out more about the built-in facilities that will prevent you from running out of space.
The following information is based off of OS X Server 10.3.5
Introduction:
OS X Server comes with a utility called diskspacemonitor. This is a configurable, cron-activated commandline tool that resides in /usr/sbin/diskspacemonitor. It is designed to periodically monitor the amount of free space on disks and execute pre-configured actions when thresholds are reached.
This tutorial provides a brief introduction to this utility.
diskspacemonitor Files:
There are several configuration files used by diskspacemonitor. If you check the /etc/diskspacemonitor/ directory you’ll find the default files installed with OS X Server. Do not edit the .default files. Copies will be made for the appropriate configuration file when the diskspacemonitor utility is activated.
[X:/etc/diskspacemonitor/] username$ ls -1F
action/
alert.conf.default
daily.server.conf
daily.server.conf.default
diskspacemonitor.conf
diskspacemonitor.conf.default
monthly.server.conf.default
recover.conf.default
weekly.server.conf.default
<code><em>action/</em><br><br> By default, the action directory contains two scripts: <em>alert</em> and <em>recover</em>. Both of these shell scripts can be configured using the respective file: <em>alert.conf</em> and <em>recover.conf</em>. <em>alert.conf.default</em><br><br> This is the default configuration file used for the alert script found at /etc/diskspacemonitor/action/alert. The three configurable variables are: subject, to, and body. These correspond with the email that is sent out by the alert script when the warning threshold is reached. </code>
# Config for alert
#
<code># Arguments passed to alert (and alert.local, if <br> # it exists): <br> # - Volume name <br> # - Threshold <br> # - Percentage full <br> # - Log file <br> # <br> subject="DiskSpaceMonitor: Disk &#36;1 has exceeded &#36;2% threshold, is &#36;3% full." <br> to=admin <br> body=`df -k -l -t ufs; df -k -l -t hfs` <br> </code>
<code>Notice that the <em>body</em> variable contains the output of the <em>df</em> command. <b>WARNING:</b> When tested on OS X Server 10.3.5 the <em>df</em> command above will fail with the following error: <em>df: -l and -t are mutually exclusive</em>. After enabling diskspacemonitor, edit the alert.conf file by deleting the "-l". For more information on <em>df</em> see the man page. <em>diskspacemonitor.conf</em><br><br> This is the main configuration file used by <em>diskspacemonitor</em>. The four configurable variables are: monitor_interval, alert_threshold, recovery_threshold, and log_file. See the output for descriptions of these variables. </code>
# Config for diskspacemonitor
#
monitor_interval=10 # Check disks at this interval, in minutes
alert_threshold=75 # When a disk is this percentage full, execute
# the alert scripts in
# /etc/diskspacemonitor/action/
recovery_threshold=85 # When a disk is this percentage full, execute
# the recovery scripts in
# /etc/diskspacemonitor/action/
log_file=/var/log/diskspacemonitor.log
<code><em>daily.server.conf</em><br><br> This is the configuration file used by <em>/etc/periodic/600.daily.server</em>, which is a log-rolling script installed by default with OS X Server. I do not recommend editing this config file unless you know what you're doing. <em>recover.conf.default</em><br><br> This is the configuration file for the <em>recover script</em> located in /etc/diskspacemonitor/action/. It defines what log files to roll or compress. Do not edit this file unless you know what you're doing. <em>Unused files</em><br><br> As of OS X Server 10.3.5 the following files don't do anything: <ul> <li> monthly.server.conf.default <li> weekly.server.conf.default </ul> </code>
Recent Comments