This reference describes Data Source composite modules in the UNIX/Linux Authoring Library example Management Pack.
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
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
The “shell command” to execute on the remote host. See the Appendix section for discussion of quotes and special characters.
Timeout
Timeout (in seconds). If the command runs for longer than the timeout, its process is stopped without waiting for completion.
UserName
The Run As reference providing the UserName of the user that will run the command/script. $RunAs[Name="#MP Alias#!#Profile Name"]/UserName$
Password
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.Authoring.TimedShellCommand.PropertyBag.DataSource
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.
System.PropertyBagData
PSScriptName
The name given to the PowerShell script
PSScriptBody
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
Unix.Authoring.TimedShellScript.DataSource
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.
ShellScript
The contents of the shell script to execute on the remote host.
ScriptArguments
Command line arguments to be passed to the script.
Timeout (in seconds). If the script runs for longer than the timeout, its process is stopped without waiting for completion.
Unix.Authoring.TimedShellScript.PropertyBag.DataSource
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.
LogFile
The full path to the log file. String wild cards are not supported.
FirstLogExpression
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
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
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).
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>
Unix.Authoring.TimedShellCommand.Discovery.DataSource
A scheduled data source module type, for use in discoveries, which runs a shell command through a WS-Management invocation.
System.Discovery.Data
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
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>
$MPElement[Name='System!System.Entity']/DisplayName$
</Settings>
</InstanceSettings>
<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>
<Name>$MPElement[Name='MyMP.MyRole']/RoleName$</Name>
<Value>My Role</Value>
<Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>
<Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>
<Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>
</Discovery>
Unix.Authoring.TimedShellCommand.PropertyBag.Discovery.DataSource
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.
<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellCommand.PropertyBag.Discovery.DataSource">
<Interval>60</Interval>
<PSScriptName>MyPSScript.ps1</PSScriptName>
<PSScriptBody>
param([string]$StdOut,[string]$StdErr,[string]$ReturnCode)
if ($ReturnCode -eq "0"){
$api = New-Object -comObject 'MOM.ScriptAPI'
$bag.AddValue("MyProperty","$StdOut")
}
</PSScriptBody>
<XPathQuery>Property[@Name='MyProperty']</XPathQuery>
Unix.Authoring.TimedShellScript.Discovery.DataSource
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.
<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellScript.Discovery.DataSource">
<ShellScript>
<![CDATA[
test=`ls -d $1 |wc -l`
echo $test
]]>
</ShellScript>
<ScriptArguments>/etc</ScriptArguments>
Unix.Authoring.TimedShellScript.PropertyBag.Discovery.DataSource
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.
<DataSource ID="DS" TypeID="UnixAuth!Unix.Authoring.TimedShellScript.PropertyBag.Discovery.DataSource">
Unix.Authoring.ScheduledClassSnapshotDataMapper
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.
The ID of the class to discover.
SettingsType
The InstanceSettings for the class instance
Unix.Authoring.ScheduledRelationshipSnapshotDataMapper
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.
RelationshipId
The ID of the relationship to discover.
SourceTypeId
The ID of the Source class type
TargetTypeId
The ID of the Target class type
SourceRoleSettings
The optional Instance Settings for the Source class type
TargetRoleSettings
The optional Instance Settings for the Target class type
RelationshipInstanceSettings
The optional Instance Settings for the Relationship