Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 817245 - Last Review: January 12, 2007 - Revision: 3.1
HOW TO: Pass Data Collector Data to a Script Action in Health Monitor
On This Page
SUMMARY
This step-by-step article describes how to use a Health Monitor data collector to pass the collected
data to a Health Monitor script action.
Health Monitor is based on Windows Management Instrumentation (WMI). Because WMI executes the Health Monitor
script actions, the WMI event data that Health Monitor
data collectors generate can be retrieved by using the
TargetEvent.EmbeddedStatusEvent object. When WMI executes the script action through Health Monitor, the
TargetEvent.EmbeddedStatusEvent object is already available to the script
and can be called without binding to the object first.
For more information about running scripts that are based on WMI events, visit the following Microsoft Web site:
When you use a Health Monitor data collector to pass the collected data to a Health Monitor script action, remember the following:
- Health Monitor data collectors cannot pass the collected data to a script action by using arguments. The TargetEvent.EmbeddedStatusEvent object must be used in the script to retrieve the collected data.
- Health Monitor data collectors can pass the collected data to command-line actions by using arguments. However, you cannot use Cscript.exe with a command-line action.
To create a simple Health Monitor script action that retrieves the data that is collected from the calling data collector, follow these steps:
- Create a Health Monitor script action that points to a script that contains the following code. Note that the code uses the TargetEvent.EmbeddedStatusEvent.EmbeddedCollectedInstance object.
Set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.CreateTextFile("C:\argTest.log", True)
f.Writeline "Test: " & TargetEvent.EmbeddedStatusEvent.EmbeddedCollectedInstance.Name
f.close This code creates a file at C:\Argtest.log and writes the name of the data instance that is collected from the calling data collector. Any property of the instance data can be retrieved in the same manner. The syntax is as follows:TargetEvent.EmbeddedStatusEvent.EmbeddedCollectedInstance.<Property Name>
- Create a new Health Monitor data collector.
Note You can also use an existing Health Monitor data collector. Any kind of data collector will work. This example uses an SMTPSVC service monitor. - Bind the data collector to the script action.
- Stop the SMTP service. The data collector reaches a critical condition threshold and executes the script action. The script receives the data collector data through the TargetEvent.EmbeddedStatusEvent.EmbeddedCollectedInstance object. This case uses the property Name, but you can use any property that the data collector supports. If you want to see a list of the properties that your WMI instance supports, view your WMI Event Query monitor in Health Monitor.
APPLIES TO
- Microsoft Application Center 2000 Standard Edition
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please