5

Very simply I am trying to trigger an email alert from a Windows 2003 server to tell me when the disk space is low.

Has anyone had experience with setting this up?

Thank you.

5
  • I actually just looked this link up for a friend. I have barely looked it through, but i think its what you want: e-protool.com/…
    – artifex
    Jan 21, 2010 at 12:23
  • That article does look like it will do the job, but just a caveat: Windows XP\2003 has no native mechanism to send email alerts. You'll need a third party app or utility (as referenced in the article) to do that.
    – joeqwerty
    Jan 21, 2010 at 13:08
  • @joeqwerty: actually, you can use the native CDO scripting interface to send email. Example here: blogs.technet.com/heyscriptingguy/archive/2004/11/29/…
    – user1804
    Jan 21, 2010 at 17:41
  • True and not True. It still requires an SMTP server, which isn't native to W2K3 out of the box. Yes, you can install the SMTP server component, but then it's starting to become a project at that point. Thanks for the link, though. It's good to know an alternate method of getting the job done.
    – joeqwerty
    Jan 21, 2010 at 18:38
  • You would use an external smtp server. As long as you have port 25 outbound you're clear.
    – user1804
    Jan 25, 2010 at 22:15

4 Answers 4

3

Rather than creating an alert for just this one item you should consider setting up Nagios or similar. You can then have it monitor just about anything you like and alert you when something is outside your predefined parameters. The relatively small amount of time needed to set it up will be more than repaid by freeing you from having to manually monitor and check things.

2

Couple of options:

a) Install a monitoring agent (e.g. nsclient++) and have a monitoring system (e.g. Nagios) monitor it and alert you when disk space is low;

b) Create a scheduled task that triggers every minute, reads the appropriate WMI counter (e.g. \\LogicalDisk(C:)\\Free Megabytes) and sends a mail using the CDO.Message WScript object (example here: http://blogs.technet.com/heyscriptingguy/archive/2004/11/29/how-can-i-attach-a-file-to-an-email-sent-using-cdo.aspx)

0

+1 for nagios (or derivatives like opsview ) and nsclient++. If you know scripting, you can easily write your own custom plugins for anything you may need.

If you are not monitoring yet, start doing it now!

0

See here: Microsoft KB 324796

I use this in our environment and it's worked great. You do need an SMTP server to send the message, but it doesn't have to be the same box.

I do checks for Low Memory (checks every 5 min to see if free memory is lower than 100 MB), Processor Monitor (checks every 30 seconds to ensure processor is not running over 95%), and Low Disk Space (checks every 30 minutes that disk space is not below 20%). They are super easy to add and I've had no issues.

Here is the VBScript file I have for an alert about high CPU usage. You could modify the script to include credentials if necessary:

' Get command line parameters
Dim ArgObj
Set ArgObj = WScript.Arguments 
Dim strFrom, strTo, strSubject, strBody, strIPAddress
strFrom = "SERVERNA<E <[email protected]>"
strTo = "RECIPIENT <[email protected]>"
strSubject = "Automated CPU Alert from SERVERNAME"
strIPAddress = "IPADDRESS"

' get the body from the command line
If ArgObj.Count > 0 Then
strBody = ArgObj( 0 )

' if the subject is specified as an argument then add it
If ArgObj.Count > 1 Then
strSubject = ArgObj( 1 )
End If
Else
strBody = "Default alert message body" 
End if

Call SendEmail( strFrom, strTo, strSubject, strBody )

' release memory
Set ArgObj = Nothing

' Sub-routing to send an e-mail using the CDO component
Sub SendEmail(sFromEmail, sToEmail, sSubject, sText )

Dim objMail
Set objMail = CreateObject( "CDO.Message" )
objMail.From = sFromEmail
objMail.To = sToEmail
objMail.Subject = sSubject

' Send using an SMTP server
objMail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 2

' Name or IP of remote SMTP server
objMail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = strIPAddress

' Server port
objMail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = 25 

objMail.Configuration.Fields.Update
objMail.TextBody = sText
objMail.Send

Set objMail = nothing

End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .