Share via


SCOM 2012: UNIX/Linux Authoring Library MP Reference - Data Source Modules

Return to section contents
       

Data Source Modules

This reference describes Data Source composite modules in the UNIX/Linux Authoring Library example Management Pack.

Scheduled Data Sources

UNIX/Linux Timed Shell Command Data Source

ID

Unix.Authoring.TimedShellCommand.DataSource

Description

A scheduled data source module type that runs a shell command through a WS-Management invocation.

Input

System.BaseData

Output

Microsoft.SystemCenter.WSManagement.WSManData

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 if the expression is not matched. This is useful for error-handling. The optional expression filter is the last module in the composite module sequence.

 

UNIX/Linux Timed Shell Command Property Bag Data Source

ID

Unix.Authoring.TimedShellCommand.PropertyBag.DataSource

Description

A scheduled data source module 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.

Input

System.BaseData

Output

System.PropertyBagData

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 if the expression is not matched. This is useful for error-handling. The optional expression filter is the last module in the composite module sequence.

 

UNIX/Linux Timed Shell Script Data Source

ID

Unix.Authoring.TimedShellScript.DataSource

Description

A scheduled data source module type that runs a shell script through a WS-Management invocation. The shell script is transferred to the UNIX/Linux host for each invocation.

Input

System.BaseData

Output

Microsoft.SystemCenter.WSManagement.WSManData

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 if the expression is not matched. This is useful for error-handling. The optional expression filter is the last module in the composite module sequence.

 

UNIX/Linux Timed Shell Script Property Bag Data Source

ID

Unix.Authoring.TimedShellScript.PropertyBag.DataSource

Description

A scheduled data source module 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.

Input

System.BaseData

Output

System.PropertyBagData

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 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 if the expression is not matched. This is useful for error-handling. The optional expression filter is the last module in the composite module sequence.

 

UNIX/Linux Correlated Log File Data Source

ID

 

Description

A scheduled data source module type for monitoring UNIX/Linux log files with two correlated Regular Expressions. The data source outputs data only when both expressions are matched within the defined correlation interval. This data source can be used for multi-line expression correlationin UNIX/Linux log file monitoring.

Input

System.BaseData

Output

Microsoft.SystemCenter.WSManagement.WSManData

Configuration

Parameter

Type

Description

TargetSystem

String

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

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$

LogFile

String

The full path to the log file.  String wild cards are not supported.

FirstLogExpression

String

A Regular Expression used in parsing the log file.  This is correlated with the Regular Expression defined as SecondLogExpression. Both expressions must be matched in the log file within the time defined by the CorrelationInterval value.  FirstLogExpression and SecondLogExpression can be matched in any order in the log file.

SecondLogExpression

String

A Regular Expression used in parsing the log file.  This is correlated with the Regular Expression defined as FirstLogExpression. Both expressions must be matched in the log file within the time defined by the CorrelationInterval value.  FirstLogExpression and SecondLogExpression can be matched in any order in the log file.

CorrelationInterval

Integer

The time interval (in seconds), in which FirstLogExpression and SecondLogExpression must both be matched within the log file in order to produce the DataItem. Because log file parsing runs at five minute intervals, CorrelationInterval should be set in increments of 300 seconds (e.g. 600, 900, 1800, 9000, etc).  

FilterExpression

Expression Type

An optional Expression that can be used for workflow filtering. If an expression is provided, the workflow will be dropped if the expression is not matched.

IndividualAlerts

Boolean

Controls the log file monitoring behavior when multiple lines match a Regular Expression in a single polling interval.  If set to True, each matched line is treated as a single DataItem.  If set to False, one DataItem contains all matched lines.

Example

<Rule ID="MyMP.CorrelatedLog.ExampleRule" Target="Unix!Microsoft.Unix.Computer" Enabled="true" Remotable="true">

<Category>EventCollection</Category>

<DataSources>

    <DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.CorrelatedLogFile.DataSource">

    <TargetSystem>

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

    </TargetSystem>

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

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

    <LogFile>/tmp/logfile</LogFile>

    <FirstLogExpression>firststring</FirstLogExpression>

    <SecondLogExpression>secondstring</SecondLogExpression>

    <CorrelationInterval>1800</CorrelationInterval>

    <IndividualAlerts>true</IndividualAlerts>

    </DataSource>

</DataSources>

<WriteActions>

    <WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">

    <Priority>1</Priority>

    <Severity>0</Severity>

    <AlertMessageId>

        $MPElement[Name="MyMP.CorrelatedLog.ExampleRule.AlertMessage"]$

    </AlertMessageId>

    <AlertParameters>

        <AlertParameter1>$Data///EventDescription$</AlertParameter1>

    </AlertParameters>

    <Suppression>

        <SuppressionValue />

    </Suppression>

    </WriteAction>

</WriteActions>

</Rule>

 

 

Scheduled Discovery Data Sources

UNIX/Linux Timed Shell Command Discovery Data Source

ID

Unix.Authoring.TimedShellCommand.Discovery.DataSource

Description

A scheduled data source module type, for use in discoveries, which runs a shell command through a WS-Management invocation.

Input

System.BaseData

Output

System.Discovery.Data

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

 A mandatory Expression for workflow filtering. The expression must be matched in order for the instance to be discovered. The expression filter is the last module in the sequence of the workflow prior to mapping of the discovery data.

ClassId

String

The ID of the class to discover.  Example syntax:
$MPElement[Name="#ClassID#"]$

 

InstanceSettings

Settings Type

The Instance Settings specification for the discovered class instance and its properties.  Example syntax:

<InstanceSettings>

  <Settings>

    <Setting>

      <Name>

$MPElement[Name='#ClassID#']/#Property#$

      </Name>

      <Value>#Value#</Value>

    </Setting>

    <Setting>

      <Name>

$MPElement[Name='System!System.Entity']/DisplayName$

      </Name>

      <Value>#Value#</Value>

    </Setting>

  </Settings>

</InstanceSettings>

Example

<Discovery ID="MyMp.MyRole.Discovery" Target="Unix!Microsoft.Unix.Computer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">

<Category>Discovery</Category>

<DiscoveryTypes>

    <DiscoveryClass TypeID="MyMP.MyRole">

    <Property TypeID="MyMP.MyRole" PropertyID="RoleName" />

    </DiscoveryClass>

</DiscoveryTypes>

<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellCommand.Discovery.DataSource">

    <Interval>28800</Interval>

    <TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>

    <ShellCommand>ls -d /etc |wc -l</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>1</Pattern>

    </RegExExpression>

    </FilterExpression>

    <ClassId>$MPElement[Name="MyMP.MyRole"]$</ClassId>

    <InstanceSettings>

    <Settings>

        <Setting>

        <Name>$MPElement[Name='MyMP.MyRole']/RoleName$</Name>

        <Value>My Role</Value>

        </Setting>

        <Setting>

        <Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>

        <Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>

        </Setting>

        <Setting>

        <Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>

        <Value>My Role</Value>

        </Setting>

    </Settings>

    </InstanceSettings>

</DataSource>

</Discovery>

 

 

UNIX/Linux Timed Shell Command Property Bag Discovery Data Source

 

ID

Unix.Authoring.TimedShellCommand.PropertyBag.Discovery.DataSource

Description

A scheduled data source module type, for use in discoveries, which 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.

Input

System.BaseData

Output

System.Discovery.Data

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

A mandatory Expression for workflow filtering. The expression must be matched in order for the instance to be discovered. The expression filter is the last module in the sequence of the workflow prior to mapping of the discovery data.

ClassId

String

The ID of the class to discover.  Example syntax:
$MPElement[Name="#ClassID#"]$

 

InstanceSettings

Settings Type

The Instance Settings specification for the discovered class instance and its properties.  Example syntax:

<InstanceSettings>

  <Settings>

    <Setting>

      <Name>

$MPElement[Name='#ClassID#']/#Property#$

      </Name>

      <Value>#Value#</Value>

    </Setting>

    <Setting>

      <Name>

$MPElement[Name='System!System.Entity']/DisplayName$

      </Name>

      <Value>#Value#</Value>

    </Setting>

  </Settings>

</InstanceSettings>

Example

<Discovery ID="MyMp.MyRole.Discovery" Target="Unix!Microsoft.Unix.Computer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">

<Category>Discovery</Category>

<DiscoveryTypes>

<DiscoveryClass TypeID="MyMP.MyRole">

<Property TypeID="MyMP.MyRole" PropertyID="RoleName" />

</DiscoveryClass>

</DiscoveryTypes>

<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellCommand.PropertyBag.Discovery.DataSource">

<Interval>60</Interval>

<TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>

<ShellCommand>ls -d /etc |wc -l</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>

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

if ($ReturnCode -eq "0"){

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

    $bag = $api.CreatePropertyBag()

    $bag.AddValue("MyProperty","$StdOut")

    $bag

}

</PSScriptBody>

<FilterExpression>

<RegExExpression>

    <ValueExpression>

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

    </ValueExpression>

    <Operator>MatchesRegularExpression</Operator>

    <Pattern>1</Pattern>

</RegExExpression>

</FilterExpression>

<ClassId>$MPElement[Name="MyMP.MyRole"]$</ClassId>

<InstanceSettings>

<Settings>

    <Setting>

    <Name>$MPElement[Name='MyMP.MyRole']/RoleName$</Name>

    <Value>My Role</Value>

    </Setting>

    <Setting>

    <Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>

    <Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>

    </Setting>

    <Setting>

    <Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>

    <Value>My Role</Value>

    </Setting>

</Settings>

</InstanceSettings>

</DataSource>

</Discovery>

 

 

UNIX/Linux Timed Shell Script Discovery Data Source

ID

Unix.Authoring.TimedShellScript.Discovery.DataSource

Description

A scheduled data source module type, for use in discoveries, which runs a shell script through a WS-Management invocation. The shell script is transferred to the UNIX/Linux host for each invocation.

Input

System.BaseData

Output

System.Discovery.Data

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 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

 A mandatory Expression for workflow filtering. The expression must be matched in order for the instance to be discovered. The expression filter is the last module in the sequence of the workflow prior to mapping of the discovery data.

ClassId

String

The ID of the class to discover.  Example syntax:
$MPElement[Name="#ClassID#"]$

 

InstanceSettings

Settings Type

The Instance Settings specification for the discovered class instance and its properties.  Example syntax:

<InstanceSettings>

  <Settings>

    <Setting>

      <Name>

$MPElement[Name='#ClassID#']/#Property#$

      </Name>

      <Value>#Value#</Value>

    </Setting>

    <Setting>

      <Name>

$MPElement[Name='System!System.Entity']/DisplayName$

      </Name>

      <Value>#Value#</Value>

    </Setting>

  </Settings>

</InstanceSettings>

Example

<Discovery ID="MyMp.MyRole.Discovery" Target="Unix!Microsoft.Unix.Computer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">

<Category>Discovery</Category>

<DiscoveryTypes>

        <DiscoveryClass TypeID="MyMP.MyRole">

        <Property TypeID="MyMP.MyRole" PropertyID="RoleName" />

        </DiscoveryClass>

</DiscoveryTypes>

<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellScript.Discovery.DataSource">

        <Interval>28800</Interval>

        <TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>

        <ShellScript>

        <![CDATA[

        test=`ls -d $1 |wc -l`

        echo $test

        ]]>

        </ShellScript>

        <ScriptArguments>/etc</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>1</Pattern>

        </RegExExpression>

        </FilterExpression>

        <ClassId>$MPElement[Name="MyMP.MyRole"]$</ClassId>

        <InstanceSettings>

        <Settings>

                <Setting>

                <Name>$MPElement[Name='MyMP.MyRole']/RoleName$</Name>

                <Value>My Role</Value>

                </Setting>

                <Setting>

                <Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>

                <Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>

                </Setting>

                <Setting>

                <Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>

                <Value>My Role</Value>

                </Setting>

        </Settings>

        </InstanceSettings>

</DataSource>

</Discovery>

 

 

UNIX/Linux Timed Shell Script Property Bag Discovery Data Source

ID

Unix.Authoring.TimedShellScript.PropertyBag.Discovery.DataSource

Description

A scheduled data source module type, for use in discoveries, which 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 command. The shell script is transferred to the UNIX/Linux host for each invocation.

Input

System.BaseData

Output

System.Discovery.Data

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 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

 A mandatory Expression for workflow filtering. The expression must be matched in order for the instance to be discovered. The expression filter is the last module in the sequence of the workflow prior to mapping of the discovery data.

ClassId

String

The ID of the class to discover.  Example syntax:
$MPElement[Name="#ClassID#"]$

 

InstanceSettings

Settings Type

The Instance Settings specification for the discovered class instance and its properties.  Example syntax:

<InstanceSettings>

  <Settings>

    <Setting>

      <Name>

$MPElement[Name='#ClassID#']/#Property#$

      </Name>

      <Value>#Value#</Value>

    </Setting>

    <Setting>

      <Name>

$MPElement[Name='System!System.Entity']/DisplayName$

      </Name>

      <Value>#Value#</Value>

    </Setting>

  </Settings>

</InstanceSettings>

Example

<Discovery ID="MyMp.MyRole.Discovery" Target="Unix!Microsoft.Unix.Computer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">

<Category>Discovery</Category>

<DiscoveryTypes>

<DiscoveryClass TypeID="MyMP.MyRole">

<Property TypeID="MyMP.MyRole" PropertyID="RoleName" />

</DiscoveryClass>

</DiscoveryTypes>

<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellScript.PropertyBag.Discovery.DataSource">

<Interval>28800</Interval>

<TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>

<ShellScript>

<![CDATA[

test=`ls -d $1 |wc -l`

echo $test

]]>

</ShellScript>

<ScriptArguments>/etc</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)

if ($ReturnCode -eq "0"){

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

$bag = $api.CreatePropertyBag()

$bag.AddValue("MyProperty","$StdOut")

$bag

}

]]>

</PSScriptBody>

<FilterExpression>

<RegExExpression>

    <ValueExpression>

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

    </ValueExpression>

    <Operator>MatchesRegularExpression</Operator>

    <Pattern>1</Pattern>

</RegExExpression>

</FilterExpression>

<ClassId>$MPElement[Name="MyMP.MyRole"]$</ClassId>

<InstanceSettings>

<Settings>

    <Setting>

    <Name>$MPElement[Name='MyMP.MyRole']/RoleName$</Name>

    <Value>My Role</Value>

    </Setting>

    <Setting>

    <Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>

    <Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>

    </Setting>

    <Setting>

    <Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>

    <Value>My Role</Value>

    </Setting>

</Settings>

</InstanceSettings>

</DataSource>

</Discovery>

 

UNIX/Linux Timed Class Snapshot Data Mapper Data Source

 

ID

Unix.Authoring.ScheduledClassSnapshotDataMapper

Description

A scheduled data source module type, for use in discoveries, which implements snapshot discovery for instances of a class. See the System.Discovery.ClassSnapshotDataMapper documentation for more information.

Input

System.BaseData

Output

System.Discovery.Data

Configuration

Parameter

Type

Description

Interval

Integer

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

ClassId

String

The ID of the class to discover.

InstanceSettings

SettingsType

The InstanceSettings for the class instance

 

UNIX/Linux Timed Relationship Snapshot Data Mapper Data Source

 

ID

Unix.Authoring.ScheduledRelationshipSnapshotDataMapper

Description

A scheduled data source module type, for use in discoveries, which implements snapshot discovery for instances of a relationship. See the System.Discovery.RelationshipSnapshotDataMapper documentation for more information.

Input

System.BaseData

Output

System.Discovery.Data

Configuration

Parameter

Type

Description

Interval

Integer

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

RelationshipId

String

The ID of the relationship to discover.

SourceTypeId

String

The ID of the Source class type

TargetTypeId

String

The ID of the Target class type

SourceRoleSettings

SettingsType

The optional Instance Settings for the Source class type

TargetRoleSettings

SettingsType

The optional Instance Settings for the Target class type

RelationshipInstanceSettings

SettingsType

The optional Instance Settings for the Relationship