Creating Monitors--an Example
This section provides an example to illustrate creating a monitor. The example shows how to create, and then link together, a data group, data collector, threshold, and action. Then, the example queries the WMI store for the Application Center event 5037 "Replication Session General Success" and logs the instance completion to a log file on the hard disk.
Action
The first step in creating a new monitoring process is to create the action because before you can add an action to a data collector, the action must exist. You can also associate an existing action to the collector.
To create an action that is logged to a text file
In the Health Monitor snap-in, expand the Health Monitor node, expand the All Monitored Computers node, and then expand the cluster node.
Right-click the Actions node, on the pop-up menu, click New, and then click Text Log Action.
On the Details tab, under Log file, either enter the path to TestDeploy01.log or click Browse to locate it.
On the General tab, in the Name box, enter Log to TestDeploy01.log
Note Use a different log file for each data collector and action.
On the Schedule tab, configure the action to run when the threshold is triggered.
Click OK.
To create an action that sends an e-mail message
This action will send an e-mail notification when the event fires. You can also send e-mail notifications for any event or condition that is monitored by Health Monitor.
In the Health Monitor snap-in, expand the Health Monitor node, expand the All Monitored Computers node, and then expand the cluster node.
Right-click the Actions node, on the pop-up menu, click New, and then click E-mail Action.
On the Details tab, enter the name for the SMTP server and other relevant information.
In the Subject text box, either enter the subject to use for the e-mail message or click the right-angle bracket (>), and then in the insertions string list, chose items to include in the subject.
On the General tab, in the Name box, enter the action name, E-mail Notification.
Click OK.
Data Group
In this step, you will create a new data group for the monitor. This is done to illustrate the process because all of the monitors in the Synchronized Monitors data group are synchronized automatically across the cluster.
To create a data group
Choose the member on which to add the data group.
By default the data group is added to the member that you are logged on to.
Right-click the cluster member node, on the pop-up menu, click New, and then click Data Group.
In the Data Group Properties dialog box, on the General tab, in the Name box, enter the group name Replication Session Monitors.
Click OK.
This creates the data group without any actions associated with it.
Data Collectors
Now you can create the data collector under the data group. The collector will run a WMI event query looking for instances of Application Center event 5037, "Replication Session General Success".
To create a data collector
Right-click the Replication Session Monitors data group.
Click New, click Data Collector, and then click WMI Event Query.
In the WMI Event Query dialog box, on the General tab, in the Name box, enter Deployment Test01 Completed.
On the Details tab, next to the Namespace box, click Browse, locate root\MicrosoftApplicationCenter, and then click OK.
Next to the Class box, click Browse, locate Replication Session General Success, and then click OK.
The list is in alphabetical order.
In the Properties box, select EventId, ReplicationId, ReplicationJobId, Status, StatusMessage, and LocalTimeFormatted.
Click Apply.
To associate an action to a data collector
On the Action tab, click New Action Association (the asterisk [*]).
In the Execute Action Properties dialog box, under Action to execute, click Log to TestDeploy01.log.
Under Execution condition, clear the Critical check box, click Warning, and then click OK.
On the Message tab, under When status changes to Critical or Warning, at the end of the message string, click the cursor, and then type a period (.).
Click the right-angle bracket (>), in the list, click EventId, and then type a comma (,).
Click the right-angle bracket (>), in the list, click ReplicationId, and then type a comma (,).
Click the right-angle bracket (>), and then in the list, click LocalTimeFormatted.
Click OK.
This creates a data collector that sends an e-mail message to the administrator, which is defined in the e-mail action with the following parameters:
% name %—the name of the data collector.
% state %—the status of the data collector (Warning).
WMI Status: % CollectionErrorCode % % CollectionErrorDescription %—information about the WMI status.
% EmbeddedCollectedInstance.EventId %—Application Center event 5037.
% EmbeddedCollectedInstance.ReplicationID %—the replication identifier for the session (for this example, TestDeploy01).
% EmbeddedCollectedInstance.LocalTimeFormatted %—the local time when the event fired.
Thresholds
In this step, you create a threshold to test the value for ReplicationID. If this value is TestDeploy01, the status of the Deployment Test01 Completed data collector is changed to Warning. If ReplicationID is any other value, no change is made.
Note The data collector remains in the Collecting state until it receives an error.
To create the threshold
Right-click the new data collector, on the pop-up menu, click New, and then click Threshold.
In the Threshold Properties dialog box, under If this condition is true, in the second box, click ReplicationId.
In the lower-left box, click Is equal to, and then in the lower-right box, enter TestDeploy01
Under The following will occur, in the list, click The status changes to Warning.
Click OK
Testing the Monitor
To verify that the new monitor works correctly, deploy an application named TestDeploy01 and an application with the default name (the current time and date). This demonstrates that the threshold is triggered when ReplicationID is TestDeploy01.
To test the monitor
In the Application Center snap-in, right click the cluster node, and then click New Deployment.
The New Deployment Wizard appears.
In the wizard, on the second page, in the Deployment name box, enter TestDeploy01
This value appears as the ReplicationID property.
To complete the wizard, click a cluster node or cluster member node to deploy to and an application to deploy, such as Default Web Site.
The deployment should complete and the status for the data collector should be Deployment Test01 Completed.
Do another deployment, this time accepting the default deployment name (the current time and date).
The status for the data collector should change to Warning. If you open the log file, you will notice that a new entry, TestDeploy01, was made for the first deployment but not for the second deployment because the threshold triggered the status change only when ReplicationID was TestDeploy01.
Did you find this information useful? Please send your suggestions and comments about the documentation to acdocs@microsoft.com.