Receive Low Disk Space Notifications via Email in Windows Server 2003
This article will assist you in configuring a performance monitor to
notify you via email when disk space is below a specified threshold.
Enable SMTP Authentication
The first thing you need to do is ensure you have an SMTP server
available for sending the notifications. The following support article
walks you through configuring SmarterMail for allowing relay through
localhost without any authentication.
Relay through SmarterMail on Localhost
Install and Configure Blat
Blat is a 3rd party utility we will install that performs the SMTP communication through the command line.
- Download Blat
- Click Open
- Unzip blat to c:\windows\system32
- Open a command prompt, Start -> Run -> cmd
- Change directory to blat installation, c:\windows\system32\blat262\full
- Configure blat to relay on localhost; blat -install localhost root@mydomain.com
You can specify the from address here; ie root@mydomain.com
Create a Batch Script to Send Email
- Open Notepad, Start > Run > notepad
- Enter the following text; replace notifyaddress@yourdomain.com with the address you want to receive the notifications TO
C:\WINDOWS\system32\blat262\full\blat.exe - -body "You are approaching
your disk limit" -t notifyaddress@yourdomain.com -s "Disk Limit"
- Save As c:\windows\system32\emailblat.bat, be sure to Save as type: All Files
Create the Performance Monitor Alert
- Start -> Administrative Tools -> Performance
- Expand Performance Logs and Alerts
- Right Click on Alerts and select New Alert Settings
- Enter a name for the New Alert Setting, ie Free Disk Space
- Click OK
- Under comment enter a description for this alert
- Click Add
- Under Performance Object select Logical Disk
- Select % Free Space from the counters list
- Click Add
- Click Close
- Change Alert when the value is to Under and set the Limit to the
numeric value where you wish to be notified, ie 500 would be 500Mb
- Change Sample Data every to the interval you wish to use for checking and receiving notifications
- Select the Action Tab
- Check run this program
- Click Browse and navigate to the emailblat.bat you created in c:\windows\system32\
- Click Apply
- Set the user to run under, generally this will be your root user and password
- Click OK
參考來源
http://www.hosting.com/support/windows-server-2003/receive-low-disk-space-notifications-via-email-in-windows-server-2003