Edit

Share via


Add-ClusterVMMonitoredItem

Configures monitoring for a service or an Event Tracing for Windows (ETW) event so that it is monitored on a virtual machine.

Syntax

VirtualMachine (Default)

Add-ClusterVMMonitoredItem
    [[-VirtualMachine] <String>]
    [-Service <StringCollection>]
    [-EventLog <String>]
    [-EventSource <String>]
    [-EventId <Int32>]
    [-OverrideServiceRecoveryActions]
    [-Wait <Int32>]
    [-Cluster <String>]
    [<CommonParameters>]

VMId

Add-ClusterVMMonitoredItem
    [-Service <StringCollection>]
    [-EventLog <String>]
    [-EventSource <String>]
    [-EventId <Int32>]
    [-OverrideServiceRecoveryActions]
    [-VMId <Guid>]
    [-Wait <Int32>]
    [-Cluster <String>]
    [<CommonParameters>]

InputObject

Add-ClusterVMMonitoredItem
    [-Service <StringCollection>]
    [-EventLog <String>]
    [-EventSource <String>]
    [-EventId <Int32>]
    [-OverrideServiceRecoveryActions]
    [-Wait <Int32>]
    [-InputObject <PSObject>]
    [-Cluster <String>]
    [<CommonParameters>]

Description

The Add-ClusterVMMonitoredItem cmdlet configures monitoring for a service or an Event Tracing for Windows (ETW) event so that it is monitored on a virtual machine. If the service fails or the event occurs, then the system responds by taking an action based on the failover configuration for the virtual machine resource. For example, the configuration might specify that the virtual machine be restarted.

Examples

Example 1

$parameters = @{
    VirtualMachine = 'test-VM11'
    EventLog = 'Microsoft-Windows-FailoverClustering-Manager/Admin'
    EventSource = 'Microsoft-Windows-FailoverClustering-Manager'
    EventId = '4708'
}
Add-ClusterVMMonitoredItem @parameters

This example adds monitoring for the ETW event ID 4708. This example uses splatting to pass parameter values from the $Parameters variable to the command. Learn more about Splatting.

Example 2

Add-ClusterVMMonitoredItem -VirtualMachine test-VM11 -Service spooler

This example configures monitoring for the print spooler service.

Parameters

-Cluster

Specifies the name of the cluster on which to run this cmdlet. If the input for this parameter is . or it is omitted, then the cmdlet runs on the local cluster.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventId

Specifies the event identifier (ID) of the event to be monitored.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventLog

Specifies the event log of the event to be monitored.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventSource

Specifies the event source of the event to be monitored.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Specifies the cluster on which to run the cmdlet, the clustered virtual machine on which to configure monitoring, and the cluster virtual machine monitored item object to monitor.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-OverrideServiceRecoveryActions

Specifies that the cluster service will fix, by overriding, the service recovery actions in the event that it isn't properly configured for monitoring. To be configured for monitoring the following conditions need to be met:

  • None of the service recovery actions are set to Restart the computer.

AND

  • At least one of the service recovery actions are set to Take no action.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Service

Specifies the name of a service to be monitored. This must be the short name, not the long name, of the service. For example, specify clussvc instead of Failover Cluster service.

Parameter properties

Type:StringCollection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VirtualMachine

Specifies the name of the clustered virtual machine on which to perform monitoring. When this parameter is specified, the cmdlet must be run on one of the host cluster nodes, or else the Cluster parameter must also be specified.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:VM

Parameter sets

VirtualMachine
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMId

Specifies the virtual machine identifier (ID).

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Wait

Specifies the time in seconds to wait for the cmdlet. If the Wait parameter isn't specified, then the cmdlet waits for completion. If the value 0 is specified, then the call is initiated and the cmdlet returns without waiting.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.FailoverClusters.PowerShell.Cluster

Microsoft.FailoverClusters.PowerShell.ClusterGroup

Microsoft.FailoverClusters.PowerShell.ClusterResource

Microsoft.FailoverClusters.PowerShell.ClusterVMMonitoredItem

Outputs

None