Microsoft Knowledge Base Email Alertz

KBAlertz.com: (817245) - 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. back to the top Introduction Health Monitor is based on Windows Management Instrumentation (WMI). Because WMI...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








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.

Introduction

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:
Running a Script Based on an Event
http://msdn2.microsoft.com/en-us/library/aa393250.aspx (http://msdn2.microsoft.com/en-us/library/aa393250.aspx)
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.

Create a Script

To create a simple Health Monitor script action that retrieves the data that is collected from the calling data collector, follow these steps:
  1. 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>
  2. 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.
  3. Bind the data collector to the script action.
  4. 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
Keywords: 
kbhowtomaster KB817245
       

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