SCOM Monitor with write-action

H S 216 Reputation points
2020-09-02T08:12:37.82+00:00

Hello

we hav an old MP with a monitor for special url-check.

The Monitor is running a script and returns a property bag with uri,state and request-time.

Now I want to change the monitor that data are written as performance values.
I want to run a powershell-script after condition-detection with property-bag-values as input parameters.

How can I do this?

#UnitMonitorType ID="MyID"#
 ...

    #DataSource ID="Scheduler" TypeID="System!System.SimpleScheduler"#
      #IntervalSeconds#$Config/IntervalSeconds$#/IntervalSeconds#
      #SyncTime#$Config/SyncTime$#/SyncTime#
    #/DataSource#
    #ProbeAction ID="Script" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe"#
      #ScriptName#MyScript.ps1#/ScriptName#
      #ScriptBody#$IncludeFileContent/Resources/Scripts/MyScript.ps1$#/ScriptBody#
      #Parameters#
      ...
    #/ProbeAction#
    #ConditionDetection ID="RequestFilter" TypeID="System!System.ExpressionFilter"#
      #Expression#
        #SimpleExpression#
          #ValueExpression#
            #XPathQuery Type="String"#Property[@Name='URI']#/XPathQuery#
          #/ValueExpression#
          #Operator#Equal#/Operator#
          #ValueExpression#
            #Value Type="String"#$Target/Property[Type="My.Class"]/URI$#/Value#
          #/ValueExpression#
        #/SimpleExpression#
      #/Expression#
    #/ConditionDetection# 
    ...

sorry, but I can't put in "<" and ">"

rg

Hansis

System Center Operations Manager
System Center Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,603 questions
0 comments No comments
{count} votes

Accepted answer
  1. CyrAz 5,181 Reputation points
    2020-09-02T09:58:47.17+00:00

    Your first post is not very clear, it looks like you have two distinct requirements :

    • Add a write action to the monitor workflow so it will collect performance metrics in the DB/DW : not possible. However, what would work is creating a custom datasource module type with your script, then use it as the datasource in the monitor type as well as in a performance rule (with an additionnal performance data mapper at the end of the workflow to convert the property bag to performance data type).
    • Run a powershell script after the monitor changes state, using data in the property bag. This is possible with a PowerShell Recovery Task and using the following syntax for the variables : $Data/StateChange/DataItem/Context/DataItem/Property[@DeezNutz =’PropertyName’]$ . More about this here : http://archive.wmug.co.uk/wmug/b/aquilaweb/posts/passing-data-items-to-recovery-actions

2 additional answers

Sort by: Most helpful
  1. H S 216 Reputation points
    2020-09-04T05:55:53.79+00:00

    Hello!
    Thank you for answer.

    So I know that it not possible to add a write-action in monitor-workflow.

    I have made a datasource with the script and the monitor and the rule are using this datasoure.

    the possibilty with recovery task is a good idea. I will take a look on it.

    rg
    hansi

    0 comments No comments

  2. Vladmir Zelenov 1 Reputation point
    2021-06-28T10:41:19.537+00:00

    Monitors can't have write actions but you can add recovery task to achieve your issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.