Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

How to create a monitor and rule that share a script supporting cookdown

Updated: April 15, 2013

Applies To: System Center Operations Manager 2007

noteNote
This exercise has been updated to include a procedure for Visual Studio Authoring Extensions in the latest version of the Management Pack Authoring Guide on the TechNet Wiki.

The following procedure shows how to create a monitor and rule based on a common data source module running a script using Operations Manager 2007 Authoring console. Before you perform this procedure, you must first complete the prerequisite procedure How to Create a Class in which you create the class to act as the target.

The workflows have the following characteristics:

  • Rule and monitor targeted at a class that has multiple instances on an agent. Because there are multiple instances, cookdown support is required.

  • The rule collects a performance value from the script while the monitor sets its state based on the comparison of the script value to specified threshold values.

  • The monitor does not support On Demand Discovery so that it does not require that you use a probe action module to run the script.

  • The script accepts arguments for the computer name of the target object’s agent and the version of the application.

  • The script itself is only a test that generates a constant value.

To create data source module to run script on schedule

  1. Select Type Library, then Data Sources.

  2. Right-click the Data Sources pane and select New and Composite Data Source.

  3. In the Choose a unique identifier box, type MyMP.DataSourceModule.MyPerformanceScriptTimed. Click OK.

  4. On the General tab, in the Name box, type Timed Performance Script Data Source

  5. On the Member Modules tab, do the following:

    1. Click Add to add a module.

    2. In the Choose Module Type box, select Microsoft.Windows.TimedScript.PropertyBagProvider.

    3. Click the button to the right side of the IntervalSeconds box and select Promote. This will enter the text $Config/IntervalSeconds$

    4. In the Module ID box, type Script. Click OK.

    5. Click the button to the right side of the SyncTime box and select Promote. This will enter the text $Config/SyncTime$

    6. In the ScriptName box, type MyCookdownScript.vbs.

    7. In the Arguments box, type $Config/ComputerName$ $Config/Version$.

    8. In the TimeoutSeconds box, type 300.

    9. Click the button. This starts the custom editor. Edit

    10. Paste the complete contents of the following script between the ScriptBody tags in the XML. Replace any text that might already exist.

      <![CDATA[
      sComputerName = WScript.Arguments(0)
      sVersion = WScript.Arguments(1)
      Set oAPI = CreateObject("MOM.ScriptAPI")
      oAPI.LogScriptEvent "MyCookdownScript.vbs",10,4, "Running script on " & sComputerName & ". Version is " & sVersion
      
      For i = 1 to 3
         Set oBag = oAPI.CreatePropertyBag()
         Call oBag.AddValue("ComputerName",sComputerName)
         Call oBag.AddValue("ComponentName","Component" & i)
         Call oBag.AddValue("Value",30)
         oAPI.AddItem(oBag)
      Next
      
      oAPI.ReturnItems
      ]]>
      
    11. Close the editor to save the script back to the module.

    12. If you receive an error that says that the IntervalSeconds parameter is invalid according to its data type, click Ignore. This error message occurs because the IntervalSeconds parameter is configured as an integer, and the Authoring Console is reading $Config/IntervalSeconds$ as a string. This variable will be replaced with an integer value when the workflow is run so the error can be ignored.

    13. Click OK to save the module configuration.

    14. Click Add to add a new module.

    15. In the Choose Module Type box, select System.Performance.DataGenericMapper.

    16. In the Module ID box, type MapToPerf. Click OK.

    17. In the ObjectName box, type MyApp.

    18. In the CounterName box, type TestCounter.

    19. In the InstanceName box, type $Data/Property[@Name='ComponentName']$

    20. In the Value box, type $Data/Property[@Name='Value']$.

    21. Click OK.

    22. In the NextModule column for the Script module, select MapToPerf.

    23. In the NextModule column for the MapToPerf module, select Module Output.

  6. On the Configuration Schema tab, do the following:

    1. Change the Type for the IntervalSeconds parameter to Integer.

    2. Clear the Required box next to the SyncTime parameter. The SyncTime parameter is optional for this module.

    3. In the Simple Configuration Schema section, click Add to add a parameter.

    4. In the Please enter the requested value box, type ComputerName. Click OK.

    5. In the Simple Configuration Schema section, click Add to add a parameter.

    6. In the Please enter the requested value box, type Version. Click OK.

  7. On the Overrideable Parameters tab, do the following:

    1. Click Add, then IntervalSeconds.

    2. In the Choose a unique identifier box, type IntervalSeconds. Click OK.

    3. Change Configuration Element to Integer.

    4. Click Add, then SyncTime.

    5. In the Choose a unique identifier box, type SyncTime. Click OK.

  8. On the Data Types tab ensure the value in the Data Types box is System.Performance.Data.

  9. Click OK to save the module.

  10. Select File, then click Save.

To create data source module to filter on instance

  1. Select Type Library, then Data Sources.

  2. Right-click the Data Sources pane and select New and Composite Data Source.

  3. In the Choose a unique identifier box, type MyMP.DataSourceModule.MyPerformanceScriptFiltered. Click OK.

  4. On the General tab, in the Name box, type Filtered Performance Script Data Source

  5. On the Member Modules tab, do the following:

    1. Click Add to add a module.

    2. In the Choose Module Type box, select MyMP.DataSourceModule.MyPerformanceScriptTimed.

    3. In the Module ID box, type Script. Click OK.

    4. Click the button to the right side of the IntervalSeconds box and select Promote. This will enter the text $Config/IntervalSeconds$

    5. Click the button to the right side of the ComputerName box and select Promote. This will enter the text $Config/ComputerName $

    6. Click the button to the right side of the Version box and select Promote. This will enter the text $Config/Version$

    7. Click Edit to start the custom editor. The SyncTime parameter must be added manually with an XML editor. This is because the Authoring Console only populates the Configuration dialog box by using parameters required for the selected module. The SyncTime parameter was configured to not be required.

    8. After the line

      <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
      
      Add the following line

      <SyncTime>$Config/SyncTime$</SyncTime>
      
    9. Close the editor to save the script back to the module.

      noteNote
      If you receive an error saying that the IntervalSeconds parameter is invalid according to its data type, click Ignore. This error message occurs because the IntervalSeconds parameter is configured as an integer, and the Authoring Console is reading $Config/IntervalSeconds$ as a string. This variable will be replaced with an integer value when the workflow is run so the error can be ignored.

    10. Click OK to save the module configuration.

    11. Click Add to add a module.

    12. In the Choose Module Type box, select System.ExpressionFilter.

    13. In the Module ID box, type FilterComponent. Click OK.

    14. Click Configure to open the Expression dialog box.

    15. Click Insert.

    16. In the Parameter Name box type InstanceName.

    17. In the Operator box select Equals.

    18. In the Value box type $Config/ComponentName$.

    19. Click OK to save the expression.

    20. Click OK to save the module configuration.

    21. In the NextModule column for the Script module, select FilterComponent.

    22. In the NextModule column for the FilterComponent module, select Module Output.

  6. On the Configuration Schema tab, do the following:

    1. Change the Type for the IntervalSeconds parameter to Integer.

    2. In the Simple Configuration Schema section, click Add to add a parameter.

    3. In the Please enter the requested value box, type SyncTime. Click OK.

    4. Clear the Required box next to the SyncTime parameter. The SyncTime parameter is optional for this module.

    5. In the Simple Configuration Schema section, click Add to add a parameter.

    6. In the Please enter the requested value box, type ComponentName. Click OK.

  7. On the Overrideable Parameters tab, do the following:

    1. Click Add, then IntervalSeconds.

    2. In the Choose a unique identifier box, type IntervalSeconds. Click OK.

    3. Change Configuration Element to Integer.

    4. Click Add, then SyncTime.

    5. In the Choose a unique identifier box, type SyncTime. Click OK.

  8. On the Data Types tab ensure the value in the Data Types box is System.Performance.Data.

  9. Click OK to save the module.

  10. Select File, then click Save.

To create rule to collect performance data

  1. Select Health Model, then Rules.

  2. Right-click the Rules pane and select New, then Custom Rule.

  3. In the Choose a unique identifier box, type MyMP. MyAppComponent.PerformanceCollectionRule. Click OK.

  4. On the General tab, do the following:

    1. In the Name box type Collect MyApp Component performance data.

    2. In the Target box, select MyMP.MyApplicationComponent.

  5. On the Modules tab, do the following:

    1. In the Data Sources section click Create.

    2. In the Choose Module Type box, select MyMP.DataSourceModule.MyPerformanceScriptFiltered.

    3. In the Module ID box, type DS. Click OK.

    4. Click Edit to modify the module parameters.

    5. In the IntervalSeconds box, type 900.

    6. Clear the text in the ComputerName box. Click the button to the right of the box, select (Host=My Computer Role 1). Now select (Host=Windows Computer) and then Principal Name (Windows Computer). This enters the text $Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$.

    7. Clear the text in the Version box. Click the button to the right side of the box and select (Host=My Computer Role 1) and then Version (My Computer Role Base). This will enter the text $Target/Host/Property[Type="MyMP.MyComputerRoleBase"]/Version$.

    8. Clear the text in the ComponentName box. Click the button to the right of the box and select ComponentName.

    9. Click OK to save the module configuration.

    10. In the Actions section click Create.

    11. In the Choose Module Type box, select Microsoft.SystemCenter.CollectPerformanceData.

    12. In the Module ID box, type WriteToDB. Click OK.

    13. In the Actions section click Create.

    14. In the Choose Module Type box, select Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData.

    15. In the Module ID box, type WriteToDW. Click OK.

  6. Click OK.

  7. Select File, then click Save.

To create monitor type using custom data source

  1. Select first Type Library and then select Monitor Types.

  2. Right-click in the Monitor Types pane, select New, and then Composite Monitor Type.

  3. In the Choose a unique identifier box, type MyMP.MyAppComponentMonitorType. Click OK.

  4. On the General tab, do the following:

    1. In the Name box, type MyApplicationComponent Monitor Type.

  5. On the States tab, do the following:

    1. Select 3 State Monitor Type.

    2. In the ID of state 1 box type UnderThreshold.

    3. In the ID of state 2 box type OverWarningThreshold.

    4. In the ID of state 3 box type OverErrorThreshold.

  6. On the Modules tab, do the following:

    1. Click Add to add a module.

    2. In the Choose Module Type box, select MyMP.DataSourceModule.MyScriptFiltered.

    3. In the Module ID box, type DataSource. Click OK.

    4. Click the button to the right of the IntervalSeconds box and select Promote. This enters the text $Config/IntervalSeconds$

    5. Click the button to the right side of the ComputerName box and select Promote. This enters the text $Config/ComputerName$

    6. Click the button to the right side of the Version box and select Promote. This enters the text $Config/Version$

    7. Click the button to the right side of the ComponentName box and select Promote. This enters the text $Config/ComponentName $

    8. Click Edit to start the custom editor. The SyncTime parameter must be added manually with an XML editor. This is because the Authoring console only populates the Configuration dialog box with required parameters for the selected module. The SyncTime parameter was configured to not be required.

    9. After the line

      <IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
      
      Add the following line

      <SyncTime>$Config/SyncTime$</SyncTime>
      
    10. Close the editor to add the XML back the Authoring Console.

      noteNote
      If you receive an error saying that the IntervalSeconds parameter is invalid according to its data type, click Ignore. This error message occurs because the IntervalSeconds parameter is configured as an integer, and the Authoring Console is reading $Config/IntervalSeconds$ as a string. This variable will be replaced with an integer value when the workflow is run so the error can be ignored.

    11. Click OK to save the module configuration.

    12. Click Add to add a module.

    13. In the Choose Module Type box, select System.ExpressionFilter.

    14. In the Module ID box, type FilterUnderThreshold. Click OK.

    15. Click Configure to open the Expression dialog box.

    16. Click Insert.

    17. In the Parameter Name box type Value.

    18. In the Operator box select Less than.

    19. In the Value box type $Config/WarningThreshold$.

    20. Click OK.

    21. In each >>>@Type box, change the value String to Integer.

    22. Click OK to save the module configuration.

    23. Click Add to add a module.

    24. In the Choose Module Type box, select System.ExpressionFilter.

    25. In the Module ID box, type FilterOverWarningThreshold. Click OK.

    26. Click Configure open the Expression dialog box.

    27. Click Insert.

    28. In the Parameter Name box type Value.

    29. In the Operator box select Greater than or equal to.

    30. In the Value box type $Config/WarningThreshold$. Click OK.

    31. Click Insert.

    32. In the Parameter Name box type Value.

    33. In the Operator box select Less than.

    34. In the Value box type $Config/ErrorThreshold$. Click OK.

    35. In each >>>@Type box, change the value String to Integer.

    36. Click OK to save the module configuration.

    37. Click Add to add a module.

    38. In the Choose Module Type box, select System.ExpressionFilter.

    39. In the Module ID box, type FilterOverErrorThreshold. Click OK.

    40. Click Configure.

    41. Click Insert.

    42. In the Parameter Name box type Value.

    43. In the Operator box select Greater than or equal to.

    44. In the Value box type $Config/ErrorThreshold$.

    45. Click OK.

    46. In each >>>@Type box, change the value String to Integer.

    47. Click OK to save the module configuration.

  7. On the Regular tab, do the following:

    1. Select UnderThreshold.

    2. Check the Include box next to DataSource.

    3. Check the Include box next to FilterUnderThreshold.

    4. In the Next Module box next to DataSource select FilterUnderThreshold.

    5. In the Next Module box next to FilterUnderThreshold select Monitor State Output.

    6. Select OverWarningThreshold.

    7. Check the Include box next to DataSource.

    8. Check the Include box next to FilterOverWarningThreshold.

    9. In the Next Module box next to DataSource select FilterOverWarningThreshold.

    10. In the Next Module box next to FilterOverWarningThreshold select Monitor State Output.

    11. Select OverErrorThreshold.

    12. Check the Include box next to DataSource.

    13. Check the Include box next to FilterOverErrorThreshold.

    14. In the Next Module box next to DataSource select FilterOverErrorThreshold.

    15. In the Next Module box next to FilterOverErrorThreshold select Monitor State Output.

  8. On the Configuration Schema tab, do the following:

    1. In the Type box next to IntervalSeconds select Integer.

    2. Click Add to add a parameter.

    3. In the Please enter the requested value box type SyncTime. Click OK.

    4. Clear the Required box next to SyncTime.

    5. Click Add to add a parameter.

    6. In the Please enter the requested value box type WarningThreshold. Click OK.

    7. In the Type box next to WarningThreshold select Integer.

    8. Click Add to add a parameter.

    9. In the Please enter the requested value box type ErrorThreshold. Click OK.

    10. In the Type box next to ErrorThreshold select Integer.

  9. On the Overrideable Parameters tab, do the following:

    1. Click Add and then IntervalSeconds.

    2. In the Choose a unique identifier box type IntervalSeconds.

    3. In the Configuration Element box for IntervalSeconds select Integer.

    4. Click Add and then SyncTime.

    5. In the Choose a unique identifier box type SyncTime.

    6. Click Add, then WarningThreshold.

    7. In the Choose a unique identifier box type WarningThreshold.

    8. In the Configuration Element box for WarningThreshold select Integer.

    9. Click Add, then ErrorThreshold.

    10. In the Choose a unique identifier box type ErrorThreshold.

    11. In the Configuration Element box for ErrorThreshold select Integer.

  10. Click OK to save the monitor type.

  11. Select File, then click Save.

To create monitor based on custom monitor type

  1. Select Health Model, then Monitors.

  2. Expand MyMP.MyApplicationComponent and then System.Health.EntityState.

  3. Right-click System.Health.PerformanceState, select New, and then Custom Unit Monitor.

  4. In the Choose a unique identifier box, type MyMP.MyAppComponent.PerformanceMonitor. Click OK.

  5. On the General tab, in the Name box, type My Application Component Performance.

  6. On the Configuration tab, do the following:

    1. Click Browse for a type….

    2. In the Choose unit monitor type box select MyMP.MyAppComponentMonitorType.

    3. In the IntervalSeconds box type 900.

    4. Clear the text in the ComputerName box. Click the button to the right side of the box and select (Host=My Computer Role 1) and then(Host=Windows Computer) and then Principal Name (Windows Computer).

    5. Clear the text in the Version box. Click the button to the right side of the box and select (Host=My Computer Role 1) and then Version (My Computer Role Base).

    6. Clear the text in the ComponentName box. Click the button to the right side of the box and select ComponentName.

    7. In the WarningThreshold box type 10.

    8. In the ErrorThreshold box type 20.

  7. On the Health tab, do the following:

    1. In the Health State box for UnderThreshold select Healthy.

    2. In the Health State box for OverWarningThreshold select Warning.

    3. In the Health State box for OverErrorThreshold select Critical.

  8. On the Alerting tab, do the following:

    1. Check the box next to Generate alerts for this monitor.

    2. In the Generate an alert when… select The monitor is in a critical or warning health state.

    3. In the Alert name: box type Performance problem detected.

  9. Click OK to save the monitor.

  10. Select File, then click Save.

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.