Skip to content

New MPToolWindowsEventAlertRule

AndreasSobczyk edited this page Nov 18, 2016 · 1 revision

#New-MPToolWindowsEventAlertRule Creates new Windows event alert rule based on event ID with option for sorting on description text and/or event level. Repeat count based on description text is default enabled but can be disabled. Target class must be hosted by Windows Computer. Returns object of type [Microsoft.EnterpriseManagement.Configuration. ManagementPackRule]

###Parameters

  • ManagementServerFQDN [string] – FQDN of the management server to connect.
    Example – "scom01.contoso.com"
  • ManagementPackName [string] – Name of the management pack.
    Example – “Contoso.SCVMM.Monitoring”
  • RuleName [string] – Name of the rule.
    Example – “VMSwitch.Script.Warning”
  • RuleDisplayName [string] – (Optional) Display name of the rule.
    Example – “VMSwitch Script Warning”
  • RuleDescription [string] – (Optional) Description of the rule.
    Example – “Rule for Script errors in VMSwitch Discovery Warning”
  • EventLogName [string] – Event log name to search in.
    Example – “Operations Manager”
  • EventId [int] – Event ID for the rule to look for.
    Example – 101
  • EventDescriptionText [string] – (Optional) String to search for in event description.
    Example – “VMSwitch”
  • EventLevel [string] – (Optional) Event level to filter on, if not specified all events is searched. Options: Error, Warning, Information.
    Example – “Error”
  • AlertSeverity [string] – (Optional) Severity of the alert. Options: Error, Warning, Information. Default is Error
    Example – “Warning”
  • RepeatCount [boolean] – (Optional) If the alert rule should repeat count on description match. Options: $true / $false. Default is $true.
    Example – $true
  • TargetClassName [string] – Name of the target class.
    Example - "Contoso.SCVMM.VMSwitch”
  • TargetClassMPName [string] – (Optional) Name of the management pack for the target class.
    Example – “Contoso.SCVMM.Discovery”
  • TargetClassMPAlias [string] –(Optional) Alias for the management pack for the target class.
    Example – “ContosoVMMDiscovery”
  • Enabled [boolean] – (Optional) Enabled setting for the rule $true / $false. Default is $false.
    Example – $true

###Example Creates a Windows event alert rule in the management pack "Contoso.SCVMM.Monitoring with the name VMSwitch.Script.Warning to target Contoso.SCVMM.VMSwitch.
The rule will look for event in the Operations manager event log with the ID 101, VMSwitch in the description field and only Error Event and create a critical alert if conditions are met.

New-MPToolWindowsEventAlertRule -ManagementServerFQDN scom01.contoso.com `
-ManagementPackName "Contoso.SCVMM.Monitoring" `
-RuleName "VMSwitch.Script.Warning" `
-RuleDescription "Rule for Script errors in VMSwitch Discovery Warning" `
-EventLogName "Operations Manager" `
-EventId 101 `
-EventDescriptionText "VMSwitch" `
-EventLevel Error `
-TargetClassName "Contoso.SCVMM.VMSwitch" `
-Enabled $true

Clone this wiki locally