To follow up on one of my previous posts:
Monitoring free drive space with Windows Server 2008 R2 and Performance Monitor
… this post serves to demonstrate how to set up drive space monitoring and email alerting in Windows Server 2003.
You would like to monitor free drive space on a server with the native features of Windows Server 2003 without having to purchase monitoring software such as SolarWinds, SCOM, etc.
I’ve found myself in plenty of situations where I need to set up a quick way of monitoring free drive space on various versions of Windows Server because I either don’t have access to the monitoring application that the company uses, lack of licenses for the monitoring application to add the new host or the company simply does not have monitoring. When this situation comes across my deployments, I simply use the native Performance Monitor feature of Windows Server 2003 to monitor and send an email alert to email addresses.
Note that Microsoft has various articles that covers setting this up so I’ll include one the links here:
HOW TO: Configure a Low Disk Space Alert by Using the Performance Logs and Alerts Feature in Windows Server 2003
Begin by opening up the performance application in Administrative Tools –> Performance:
Once the Performance application launches, navigate to Performance Logs and Alerts –> Alerts, right click on the node and select New Alert Settings…:
Type in a name for the alert you’re setting up:
In the properties window of the alert, click on the Add button:
In the Add Counters window, change the Performance object to LogicalDisk and you’ll see that % Free Space:
… and Free Megabytes is available for monitoring the drives:
Where you use % Free Space or Free Megabytes will be based on the type of application and drive size you’ll be monitoring. I personally prefer Free Megabytes because the drive I’m monitoring is a 1TB drive and setting up a hard threshold based on a constant value seems to make more sense. Notice that I’ve selected all of the drives to be monitored but it’s possible to create separate counters to monitor each drive providing you the flexibility to send different alert emails:
With the counters added, proceed by editing each of them to:
- Alert under a certain threshold in MB
- Sample the data every x amount of seconds, minutes or hours
- Run the alert as a service account
**Note that while I was able to use the default local service account to write events to the application logs, I was unable to configure it to execute a vbs script to send an email so I ended up using a service account that was a local administrator on the server.
Unlike Windows Server 2008, Windows Server 2003 does not natively provide a “send an email” action so the way I configured the alert to send off an email was to use a vbs script so navigate to the Action tab, select Run this program and enter C:\Windows\system32\cscript.exe, then click on the Command Line Arguments... button:
Select Text message and enter the location of the vbs script:
I simply created a C:\Scripts folder with a vbs script that uses CDO.Message to send emails:
The following is the code:
MyEmail.Subject="Exchange Drive Space Alert"
MyEmail.TextBody="One of the drives on Exchange is running low on space."
**Note that you can use a ; to add more email addresses to the recipient of this email.
As per the Microsoft KB I included above, in order for the counter to automatically start after a reboot, you’ll need to set the Stop scan options so that the After field is a value of 100000 and the Units field is days:
Proceed with starting the alert once it has been set up:
Test the alert to ensure that the email notifications are sent and received.