In my previous article, I outlined how one could monitor a performance counter and send alerts to a pager or smartphone on a Windows 2003 server.
This is how to do it on Windows Server 2008:
-
- Create a command-line script (batch file) that will be called to send the alert.
First, I usually create a folder to store my task files (i.e., C:tasks), and this is where I would create the batch file needed to send an alert to my cell phone. The message will be sent via the mail server used by my cell phone service provider.
To actually send an email from the command line, I use a nifty tool called bmail.exe from Beyond Logic. You can get it from here: http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm
Put the bmail.exe tool in the same folder where the script will be stored (or place it somewhere in the system path).
Here is my sample batch file or script, which you can test yourself by substituting your own addresses:
-
- Use Performance Monitor (or PerfMon) to identify the counter to be monitored and set the threshold trigger to call the script.
Heres the procedure (for Windows 2008):
- Go to Start > Run > Perfmon.msc
- Expand Data Collector Sets > User Defined > New Data Collector Set
- Right-click and select New Collector Set
- Enter a name for the data collector, select Performance counter alert from the list and click Next.
- Select the counter you want to use for monitoring and add it to the counter list by clicking the Add button at the bottom and click OK.
[cta id=’18654′]
In this example, I’m monitoring the Outbound Delivery Queue of my mail server.
- Enter the Limit (threshold) and click Next.
In my case, I want an alert if there are more than 200 messages in the outbound queue.
- Check Open properties for this data collector and click Finish.
- The collector information pane should appear next.
- Open the Alert Task tab.
- In the Run this task¦ field, enter the location of the script you created to send alerts to you (in Step 1), and click OK to finalize.
Assuming you tested the script beforehand and it was shown to work, you should get an email or alert when the counter passes the threshold you specified.
Leave a Comment