SCOM 2012: UNIX/Linux Authoring Library MP Reference - Unit Monitor Types

Return to section contents
       

Unit Monitor Types

This reference describes Unit Monitor Types in the UNIX/Linux Authoring Library example Management Pack.

Process Monitoring Monitor Types

 

UNIX/Linux Process Count Monitor Type

ID

Unix.Authoring.WSManEnumeration.ProcessCount.MonitorType

Description

A monitor type that monitors the count of running instances of specified process, with optional argument filtering.

Type

Two-State

Data Source

Microsoft.Unix.Process.Library!Microsoft.Unix.WSMan.ProcessEnumerator

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ProcessName

String

The name of the process to monitor

Arguments FilterExpression

String

An optional Regular Expression that can be used to distinguish between multiple instances of processes with the same name. The process arguments of the processes with a name matching ProcessName are evaluated against this Regular Expression. Only processes with arguments that match the Regular Expression are evaluated by the monitor.

Min

ProcessCount

Integer

The minimum count of running processes. If the count of processes matching the ProcessName and Arguments Filter Expression is less than this value, the monitor will be set to an Error state.

Max ProcessCount

Integer

The maximum count of running processes. If the count of processes matching the ProcessName and Arguments Filter Expression is greater than this value, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.MyProcessMonitor.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.WSManEnumeration.ProcessCount.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.MyProcessMonitor.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="Count"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="ProcessCountOK" MonitorTypeStateID="ProcessCountOK" HealthState="Success" />

    <OperationalState ID="ProcessCountError" MonitorTypeStateID="ProcessCountError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ProcessName>mydaemon</ProcessName>

    <ArgumentsFilterExpression></ArgumentsFilterExpression>

    <MinProcessCount>1</MinProcessCount>

    <MaxProcessCount>5</MaxProcessCount>

</Configuration>

</UnitMonitor>

 

 

Shell Command Monitor Types

UNIX/Linux Shell Command Matches Expression Two-State Monitor Type

ID

Unix.Authoring.ShellCommand.MatchesRegExp.TwoState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and evaluates the StdOut value against a Regular Expression to determine health state.

Type

Two-State

Data Source

Unix.Authoring.TimedShellCommand.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ErrorRegExp

String

A Regular Expression that is compared to the StdOut of the shell command. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp expression is not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellCommand.Expression.TwoState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.MatchesRegExp.TwoState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.Expression.TwoState.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

       $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>    

    <TargetSystem>

      $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellCommand>echo 'Error'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <ErrorRegExp>^Error</ErrorRegExp>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Command Matches Expression Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.MatchesRegExp.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and evaluates the StdOut value against Regular Expressions to determine health state.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ErrorRegExp

String

A Regular Expression that is compared to the StdOut of the shell command. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

WarningRegExp

String

A Regular Expression that is compared to the StdOut of the shell command. If the WarningRegExp expression is matched, the monitor is set to a Warning state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellCommand.Expression.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.MatchesRegExp.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.Expression.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

                $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

                $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellCommand>echo 'Warning'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <ErrorRegExp>^Error</ErrorRegExp>

    <WarningRegExp>^Warning</WarningRegExp>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Command Less Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.LessThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and evaluates the StdOut value against numeric warning and error threshold values.  For use in monitoring command output with numeric data, where errors are indicated by values lower than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Warning
Threshold

Double

The threshold for the Warning state. If the value of StdOut is less than this threshold, but greater than the Error Threshold, the monitor will be set to a Warning state. If the value is greater than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value of StdOut is less than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellCommand.LessThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.LessThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.LessThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

                $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

                $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellCommand>echo 75</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>//*[local-name()="StdOut"]</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>^[-+]?\d*[0-9]*(\.[0-9]+)?[Ee]?[-+]?[0-9]*$</Pattern>

    </RegExExpression>

    </FilterExpression>

    <WarningThreshold>100</WarningThreshold>

    <ErrorThreshold>50</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

 

 

UNIX/Linux Shell Command Greater Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.GreaterThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and evaluates the StdOut value against numeric warning and error threshold values.  For use in monitoring command output with numeric data, where errors are indicated by values higher than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Warning
Threshold

Double

The threshold for the Warning state. If the value of StdOut is greater than this threshold, but less than the Error Threshold, the monitor will be set to a Warning state. If the value is less than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value of StdOut is greater than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellCommand.GreaterThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.GreaterThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

       $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

       $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellCommand>echo 102</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>//*[local-name()="StdOut"]</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>^[-+]?\d*[0-9]*(\.[0-9]+)?[Ee]?[-+]?[0-9]*$</Pattern>

    </RegExExpression>

    </FilterExpression>

    <WarningThreshold>50</WarningThreshold>

    <ErrorThreshold>100</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

 

Shell Command Property Bag Monitor Types

 

UNIX/Linux Shell Command Property Bag Matches Expression Two-State Monitor Type

ID

Unix.Authoring.ShellCommand.PropertyBag.MatchesRegExp.TwoState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell command. The specified value in the Property Bag is evaluated against a Regular Expression to determine health state.

Type

Two-State

Data Source

Unix.Authoring.TimedShellCommand.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell command, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

ErrorRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp expression is not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellCommand.PropertyBag.Expression.TwoState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.PropertyBag.MatchesRegExp.TwoState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.PropertyBag.Expression.TwoState.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='PropertyValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </TargetSystem>

    <ShellCommand>echo 'MyPropertyA:Error,MyPropertyB:OK'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("PropertyName",$sName)

            $bag.AddValue("PropertyValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='PropertyName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyPropertyA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='PropertyValue']</ValueXPath>

    <ErrorRegExp>^Error</ErrorRegExp>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Command Property Bag Matches Expression Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.PropertyBag.MatchesRegExp.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell command. The specified value in the Property Bag is evaluated against Regular Expressions to determine health state.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell command, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

ErrorRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

WarningRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the WarningRegExp expression is matched, the monitor is set to an Warning state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellCommand.PropertyBag.Expression.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.PropertyBag.MatchesRegExp.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.PropertyBag.Expression.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='PropertyValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellCommand>echo 'MyPropertyA:Warning,MyPropertyB:OK'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("PropertyName",$sName)

            $bag.AddValue("PropertyValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='PropertyName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyPropertyA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='PropertyValue']</ValueXPath>

    <ErrorRegExp>^Error</ErrorRegExp>

    <WarningRegExp>^Warning</WarningRegExp>

</Configuration>

</UnitMonitor>

 

UNIX/Linux Shell Command Property Bag Less Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.PropertyBag.LessThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell command. The specified value of the Property Bag is evaluated against numeric warning and error threshold values.  For use in monitoring numeric values, where errors are indicated by values lower than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell command, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by ValueXPath is lower than this threshold, but greater than the Error Threshold, the monitor will be set to a Warning state. If the value is greater than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value specified by ValueXPath is lower than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellCommand.PropertyBag.LessThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.PropertyBag.LessThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.PropertyBag.LessThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='CounterValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellCommand>echo 'MyCounterA:88,MyCounterB:77'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("CounterName",$sName)

            $bag.AddValue("CounterValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='CounterName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyCounterA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='CounterValue']</ValueXPath>

    <WarningThreshold>100</WarningThreshold>

    <ErrorThreshold>50</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

UNIX/Linux Shell Command Property Greater Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellCommand.PropertyBag.GreaterThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell command through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell command. The specified value of the Property Bag is evaluated against numeric warning and error threshold values.  For use in monitoring numeric values, where errors are indicated by values greater than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellCommand.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellCommand

String

The “shell command” to execute on the remote host.  See the Appendix section for discussion of quotes and special characters.

Timeout

Integer

Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell command, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by ValueXPath is greater than this threshold, but less than the Error Threshold, the monitor will be set to a Warning state. If the value is less than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value specified by ValueXPath is greater than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellCommand.PropertyBag.GreaterThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellCommand.PropertyBag.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellCommand.PropertyBag.GreaterThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='CounterValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellCommand>echo 'MyCounterA:88,MyCounterB:77'</ShellCommand>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("CounterName",$sName)

            $bag.AddValue("CounterValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='CounterName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyCounterA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='CounterValue']</ValueXPath>

    <WarningThreshold>50</WarningThreshold>

    <ErrorThreshold>100</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

Shell Script Monitor Types

 

UNIX/Linux Shell Script Matches Expression Two-State Monitor Type

ID

Unix.Authoring.ShellScript.MatchesRegExp.TwoState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and evaluates the StdOut value against a Regular Expression to determine health state.

Type

Two-State

Data Source

Unix.Authoring.TimedShellScript.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ErrorRegExp

String

A Regular Expression that is compared to the StdOut of the shell script. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp expression is not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellScript.Expression.TwoState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.MatchesRegExp.TwoState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.Expression.TwoState.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo $1

    ]]>

    </ShellScript>

    <ScriptArguments>Error</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <ErrorRegExp>^Error</ErrorRegExp>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Script Matches Expression Three-State Monitor Type

ID

Unix.Authoring.ShellScript.MatchesRegExp.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and evaluates the StdOut value against Regular Expressions to determine health state.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ErrorRegExp

String

A Regular Expression that is compared to the StdOut of the shell script. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

WarningRegExp

String

A Regular Expression that is compared to the StdOut of the shell script. If the WarningRegExp expression is matched, the monitor is set to a Warning state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellScript.Expression.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.MatchesRegExp.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.Expression.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo $1

    ]]>

    </ShellScript>

    <ScriptArguments>Error</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <ErrorRegExp>^Error</ErrorRegExp>

    <WarningRegExp>^Warning</WarningRegExp>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Script Less Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellScript.LessThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and evaluates the StdOut value against numeric warning and error threshold values.  For use in monitoring command output with numeric data, where errors are indicated by values lower than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Warning
Threshold

Double

The threshold for the Warning state. If the value of StdOut is less than this threshold, but greater than the Error Threshold, the monitor will be set to a Warning state. If the value is greater than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value of StdOut is less than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellScript.LessThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.LessThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.LessThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo $1

    ]]>

    </ShellScript>

    <ScriptArguments>75</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>//*[local-name()="StdOut"]</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>^[-+]?\d*[0-9]*(\.[0-9]+)?[Ee]?[-+]?[0-9]*$</Pattern>

    </RegExExpression>

    </FilterExpression>

    <WarningThreshold>100</WarningThreshold>

    <ErrorThreshold>50</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

 

UNIX/Linux Shell Script Greater Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellScript.GreaterThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and evaluates the StdOut value against numeric warning and error threshold values.  For use in monitoring command output with numeric data, where errors are indicated by values greater than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Warning
Threshold

Double

The threshold for the Warning state. If the value of StdOut is greater than this threshold, but less than the Error Threshold, the monitor will be set to a Warning state. If the value is less than the Warning Threshold, the monitor will be set to a Healthy state

Error Threshold

Double

The threshold for the Error state. If the value of StdOut is greater than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellScript.GreaterThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.GreaterThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context///*[local-name()="StdOut"]$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo $1

    ]]>

    </ShellScript>

    <ScriptArguments>75</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>//*[local-name()="StdOut"]</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>^[-+]?\d*[0-9]*(\.[0-9]+)?[Ee]?[-+]?[0-9]*$</Pattern>

    </RegExExpression>

    </FilterExpression>

    <WarningThreshold>50</WarningThreshold>

    <ErrorThreshold>100</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

Shell Script Property Bag Monitor Types

 

UNIX/Linux Shell Script Property Bag Matches Expression Two-State Monitor Type

ID

Unix.Authoring.ShellScript.PropertyBag.MatchesRegExp.TwoState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell script. The specified value in the Property Bag is evaluated against a Regular Expression to determine health state.

Type

Two-State

Data Source

Unix.Authoring.TimedShellScript.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell script, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

ErrorRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp expression is not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellScript.PropertyBag.Expression.TwoState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.PropertyBag.MatchesRegExp.TwoState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.PropertyBag.Expression.TwoState.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='PropertyValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo "MyPropertyA:$1,MyPropertyB:$2"

    ]]>

    </ShellScript>

    <ScriptArguments>Error OK</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("PropertyName",$sName)

            $bag.AddValue("PropertyValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='PropertyName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyPropertyA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='PropertyValue']</ValueXPath>

    <ErrorRegExp>^Error</ErrorRegExp>

</Configuration>

</UnitMonitor>

 

UNIX/Linux Shell Script Property Bag Matches Expression Three-State Monitor Type

ID

Unix.Authoring.ShellScript.PropertyBag.MatchesRegExp.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell script. The specified value in the Property Bag is evaluated against Regular Expressions to determine health state.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell script, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

ErrorRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

WarningRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the WarningRegExp expression is matched, the monitor is set to an Warning state. If the ErrorRegExp and WarningRegExp expressions are not matched, the monitor is set to a Healthy state.

Example

<UnitMonitor ID="MyMP.ShellScript.PropertyBag.Expression.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.PropertyBag.MatchesRegExp.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.PropertyBag.Expression.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='PropertyValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo "MyPropertyA:$1,MyPropertyB:$2"

    ]]>

    </ShellScript>

    <ScriptArguments>Warning OK</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("PropertyName",$sName)

            $bag.AddValue("PropertyValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='PropertyName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyPropertyA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='PropertyValue']</ValueXPath>

    <ErrorRegExp>^Error</ErrorRegExp>

    <WarningRegExp>^Warning</WarningRegExp>

</Configuration>

</UnitMonitor>

 

UNIX/Linux Shell Script Property Bag Less Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellScript.PropertyBag.LessThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell script The specified value of the Property Bag is evaluated against numeric warning and error threshold values.  For use in monitoring numeric values, where errors are indicated by values lower than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell script, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by ValueXPath is lower than this threshold, but greater than the Error Threshold, the monitor will be set to a Warning state. If the value is greater than the Warning Threshold, the monitor will be set to a Healthy state.

Error Threshold

Double

The threshold for the Error state. If the value specified by ValueXPath is lower than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellScript.PropertyBag.LessThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.PropertyBag.LessThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.PropertyBag.LessThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='CounterValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo "MyCounterA:$1,MyCounterB:$2"

    ]]>

    </ShellScript>

    <ScriptArguments>88 77</ScriptArguments>

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("CounterName",$sName)

            $bag.AddValue("CounterValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='CounterName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyCounterA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='CounterValue']</ValueXPath>

    <WarningThreshold>100</WarningThreshold>

    <ErrorThreshold>50</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

UNIX/Linux Shell Script Property Bag Greater Than Threshold Three-State Monitor Type

ID

Unix.Authoring.ShellScript.PropertyBag.GreaterThanThreshold.ThreeState.MonitorType

Description

A monitor type that runs a shell script through a WS-Management invocation, and passes the output to a Microsoft.Windows.PowerShellPropertyBagProbe probe action.  The PowerShell Property Bag probe can be used to parse and manipulate output from the shell script. The specified value of the Property Bag is evaluated against numeric warning and error threshold values.  For use in monitoring numeric values, where errors are indicated by values greater than a threshold.

Type

Three-State

Data Source

Unix.Authoring.TimedShellScript.PropertyBag.DataSource

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

ShellScript

String

The contents of the shell script to execute on the remote host.

ScriptArguments

String

Command line arguments to be passed to the script.

Timeout

Integer

Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.

UserName

String

The Run As reference providing the UserName of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$

Password

String

The Run As reference providing the Password of the user that will run the command/script.  $RunAs[Name="#MP Alias#!#Profile Name"]/Password$

PSScriptName

String

The name given to the PowerShell script

PSScriptBody

String

The body of the PowerShell script.  In order to reference output from the shell script, the script must start with:

param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)


The PowerShell script should return one or more Property Bags, using syntax such as:

$api = New-Object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

$bag.AddValue("Name","Value")

$bag

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned Property Bag to evaluate for monitoring.  For example, the following XPath evaluates the property with the name MyProperty:
Property[@Name='MyProperty']

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by ValueXPath is greater than this threshold, but less than the Error Threshold, the monitor will be set to a Warning state. If the value is less than the Warning Threshold, the monitor will be set to a Healthy state.

Error Threshold

Double

The threshold for the Error state. If the value specified by ValueXPath is greater than this threshold, the monitor will be set to an Error state.

Example

<UnitMonitor ID="MyMP.ShellScript.PropertyBag.GreaterThan.ThreeState.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.ShellScript.PropertyBag.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.ShellScript.PropertyBag.GreaterThan.ThreeState.Monitor.AlertMessage">

    <AlertOnState>Warning</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </AlertParameter1>

    <AlertParameter2>$Data/Context/DataItem/Property[@Name='CounterValue']$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

        </TargetSystem>

    <ShellScript>

    <![CDATA[

        echo "MyCounterA:$1,MyCounterB:$2"

    ]]>

    </ShellScript>

    <ScriptArguments>88 77</ScriptArguments>         

    <Timeout>60</Timeout>

    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>

    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>

    <PSScriptName>MyPSScript.ps1</PSScriptName>

    <PSScriptBody>

    <![CDATA[

        param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)

             

        $api = New-Object -comObject 'MOM.ScriptAPI'

        [array]$arCounters=$StdOut.Split(",")

        ForEach($counter in $ArCounters){

        $sName=$counter.Split(":")[0]

        $sValue=$counter.split(":")[1].trim()

               

        if ($sValue -ne $null){

            $bag = $api.CreatePropertyBag()

            $bag.AddValue("CounterName",$sName)

            $bag.AddValue("CounterValue",$sValue)

            $bag

        }

        }

        ]]>

    </PSScriptBody>

    <FilterExpression>

    <RegExExpression>

        <ValueExpression>

        <XPathQuery>Property[@Name='CounterName']</XPathQuery>

        </ValueExpression>

        <Operator>MatchesRegularExpression</Operator>

        <Pattern>MyCounterA</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ValueXPath>Property[@Name='CounterValue']</ValueXPath>

    <WarningThreshold>50</WarningThreshold>

    <ErrorThreshold>100</ErrorThreshold>

</Configuration>

</UnitMonitor>

 

WS-Management Enumeration Monitor Types

UNIX/Linux WS-Man Enumeration Matches Expression Two-State Monitor Type

ID

Unix.Authoring.WSManEnumeration.MatchesRegExp.TwoState.MonitorType

Description

A monitor type that performs a WS-Management Enumeration of a specified class (filtered by a specified instance name), and evaluates a specified property value against a Regular Expression to determine health state.

Type

Two-State

Data Source

Microsoft.Unix.Library!Microsoft.Unix.WSMan.TimedEnumerator.Filtered

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

Uri

String

The URI of the CIM class to enumerate. For example, the URI to enumerate the SCX_FileSystem class is:
http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_FileSystem?__cimnamespace=root/scx

WSManFilter

String

An optional filter for use in the WSMan enumeration, in the form of a CQL query. For example:
select name from SCX_UnixProcess

InstanceXPath

String

An XPath query that identifies the value of the returned DataItem to compare against the provided InstanceName.  This is used so that a monitor will only evaluate the state of a specific instance, when multiple instances are returned by the CIM class enumeration. For example, this InstanceXPath value would evaluate the “Name” property of an SCX_FileSystem instance:
/DataItem/WsManData/*[local-name(.)='SCX_FileSystem']/*[local-name(.)='Name']

InstanceName

String

The value to compare with InstanceXPath for filtering. This is typically a property of the monitor Target.  For example:
$Target/Property[Type="Unix!Microsoft.Unix.LogicalDevice"]/DeviceID$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

ValueXPath

String

An XPath query that identifies the value of the returned DataItem to evaluate for monitoring.  For example, the following XPath evaluates the PercentUsedInodes property of the SCX_FileSystemClass:
/DataItem/WsManData/*[local-name(.)='SCX_FileSystemStatisticalInformation']/*[local-name(.)='PercentUsedInodes']

ErrorRegExp

String

A Regular Expression that is compared to the value specified by ValueXPath. If the ErrorRegExp expression is matched, the monitor is set to an Error state. If the ErrorRegExp expression is not matched, the monitor is set to a Healthy state.

 

UNIX/Linux WS-Man Enumeration Less Than Threshold Three-State Monitor Type

ID

Unix.Authoring.WSManEnumeration.LessThanThreshold.ThreeState.MonitorType

Description

A monitor type that performs a WS-Management Enumeration of a specified class (filtered by a specified instance name), and evaluates a specified property value against numeric warning and error threshold values.  For use in monitoring properties with numeric data types, where errors are indicated by values lower than a threshold. The value of the specified property is averaged before evaluation.

Type

Three-State

Data Source

Microsoft.Unix.Library!Microsoft.Unix.WSMan.PerfCounterProvider.Filtered

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

Uri

String

The URI of the CIM class to enumerate. For example, the URI to enumerate the SCX_FileSystem class is:
http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_FileSystem?__cimnamespace=root/scx

WSManFilter

String

An optional filter for use in the WSMan enumeration, in the form of a CQL query. For example:
select name from SCX_UnixProcess

ObjectName

String

The Object name used in performance data mapping.

CounterName

String

The Counter name used in performance data mapping.

InstanceXPath

String

An XPath query that identifies the value of the returned DataItem to compare against the provided InstanceName.  This is used so that a monitor will only evaluate the state of a specific instance, when multiple instances are returned by the CIM class enumeration. For example, this InstanceXPath value would evaluate the “Name” property of an SCX_FileSystem instance:
/DataItem/WsManData/*[local-name(.)='SCX_FileSystem']/*[local-name(.)='Name']

InstanceName

String

The value to compare with InstanceXPath for filtering. This is typically a property of the monitor Target.  For example:
$Target/Property[Type="Unix!Microsoft.Unix.LogicalDevice"]/DeviceID$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Value

String

An XPath query, in the form of a $Data$ variable, that identifies the value of the returned DataItem to evaluate for monitoring.  For example, the following Value specification h evaluates the PercentUsedInodes property of the SCX_FileSystemStatisticalInformation Class:
$Data/WsManData/*[local-name(.)='SCX_FileSystemStatisticalInformation']/*[local-name(.)='PercentUsedInodes']$

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by Value is lower than this threshold, but greater than the Error Threshold, the monitor will be set to a Warning state. If the value is greater than the Warning Threshold, the monitor will be set to a Healthy state.

Error Threshold

Double

The threshold for the Error state. If the value specified by Value is lower than this threshold, the monitor will be set to an Error state.

NumSamples

Integer

The number of samples to average before threshold evaluation.

 

UNIX/Linux WS-Man Enumeration Greater Than Threshold Three-State Monitor Type

ID

Unix.Authoring.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType

Description

A monitor type that performs a WS-Management Enumeration of a specified class (filtered by a specified instance name), and evaluates a specified property value against numeric warning and error threshold values.  For use in monitoring properties with numeric data types, where errors are indicated by values higher than a threshold.

Type

Three-State

Data Source

Microsoft.Unix.Library!Microsoft.Unix.WSMan.TimedEnumerator.Filtered

Configuration

Parameter

Type

Description

Interval

Integer

The frequency interval, in seconds, at which the data source will run.

TargetSystem

String

The target system for the monitor.  Typically: $Target/#HostReferences#/Property[Type="#Unix Library Alias#!Microsoft.Unix.Computer"]/NetworkName$

Uri

String

The URI of the CIM class to enumerate. For example, the URI to enumerate the SCX_FileSystem class is:
http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_FileSystem?__cimnamespace=root/scx

WSManFilter

String

An optional filter for use in the WSMan enumeration, in the form of a CQL query. For example:
select name from SCX_UnixProcess

ObjectName

String

The Object name used in performance data mapping.

CounterName

String

The Counter name used in performance data mapping.

InstanceXPath

String

An XPath query that identifies the value of the returned DataItem to compare against the provided InstanceName.  This is used so that a monitor will only evaluate the state of a specific instance, when multiple instances are returned by the CIM class enumeration. For example, this InstanceXPath value would evaluate the “Name” property of an SCX_FileSystem instance:
/DataItem/WsManData/*[local-name(.)='SCX_FileSystem']/*[local-name(.)='Name']

InstanceName

String

The value to compare with InstanceXPath for filtering. This is typically a property of the monitor Target.  For example:
$Target/Property[Type="Unix!Microsoft.Unix.LogicalDevice"]/DeviceID$

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped (before evaluating the monitoring state) if the expression is not matched. This is useful for error-handling.

Value

String

An XPath query, in the form of a $Data$ variable, that identifies the value of the returned DataItem to evaluate for monitoring.  For example, the following Value specification h evaluates the PercentUsedInodes property of the SCX_FileSystemStatisticalInformation Class:
$Data/WsManData/*[local-name(.)='SCX_FileSystemStatisticalInformation']/*[local-name(.)='PercentUsedInodes']$

Warning
Threshold

Double

The threshold for the Warning state. If the value specified by Value is higher than this threshold, but less than the Error Threshold, the monitor will be set to a Warning state. If the value is less than the Warning Threshold, the monitor will be set to a Healthy state.

Error Threshold

Double

The threshold for the Error state. If the value specified by Value is higher than this threshold, the monitor will be set to an Error state.

NumSamples

Integer

The number of samples to average before threshold evaluation.

Example

<UnitMonitor ID="MyMP.WSManEnumGreaterThan.Monitor" Accessibility="Internal" Enabled="true" Target="MyMP.MyRole" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">

<Category>AvailabilityHealth</Category>

<AlertSettings AlertMessage="MyMP.WSManEnumGreaterThan.Monitor.AlertMessage">

    <AlertOnState>Error</AlertOnState>

    <AutoResolve>true</AutoResolve>

    <AlertPriority>Normal</AlertPriority>

    <AlertSeverity>MatchMonitorHealth</AlertSeverity>

    <AlertParameters>

    <AlertParameter1>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

    </AlertParameter1>

    <AlertParameter2>$Data/Context/Value$</AlertParameter2>

    </AlertParameters>

</AlertSettings>

<OperationalStates>

    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />

    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />

    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />

</OperationalStates>

<Configuration>

    <Interval>300</Interval>

    <TargetSystem>

        $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$

     </TargetSystem>

    <Uri>

        http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_UnixProcessStatisticalInformation?__cimnamespace=root/scx

     </Uri>

    <WSManFilter>Select Name,PercentUsedMemory,PercentUserTime from SCX_UnixProcessStatisticalInformation</WSManFilter>

    <ObjectName>Process</ObjectName>

    <CounterName>Percent User Time</CounterName>

    <InstanceXPath>

        /DataItem/WsManData/*[local-name(.)='SCX_UnixProcessStatisticalInformation']/*[local-name(.)='Name']

     </InstanceXPath>

    <InstanceName>scxcimserver</InstanceName>

    <FilterExpression>

    <Not>

        <Expression>

        <Exists>

            <ValueExpression>

            <XPathQuery Type="String">WsManData/ErrorCode</XPathQuery>

            </ValueExpression>

        </Exists>

        </Expression>

    </Not>

    </FilterExpression>

    <Value>

        $Data/WsManData/*[local-name(.)='SCX_UnixProcessStatisticalInformation']/*[local-name(.)='PercentUserTime']$

     </Value>

    <WarningThreshold>10</WarningThreshold>

    <ErrorThreshold>20</ErrorThreshold>

    <NumSamples>2</NumSamples>

</Configuration>

</UnitMonitor>