PowerCLI Reference

New-AlarmTrigger

Synopsis

This cmdlet adds ? new alarm trigger to the existing alarm or creates ? new alarm trigger.

Syntax

New-AlarmTrigger -AlarmDefinition <AlarmDefinition[]> [-Confirm] [-EntityStatus {Gray | Green | Yellow | Red | Unknown}] -EntityType <String> [-Server <VIServer[]>] -StateAlarmOperator {Equal | NotEqual | Unknown} -StatePath <String> -Value <String> [-WhatIf] [<CommonParameters>]

New-AlarmTrigger -AlarmDefinition <AlarmDefinition[]> [-Confirm] [-EntityStatus {Gray | Green | Yellow | Red | Unknown}] -EntityType <String> -EventType <EventType> [-Server <VIServer[]>] [-WhatIf] [<CommonParameters>]

New-AlarmTrigger -AlarmDefinition <AlarmDefinition[]> [-Confirm] -EntityType <String> -Metric <Metric> -MetricAlarmOperator {Above | Below | Unknown} [-Red <Int32>] [-RedIntervalSeconds <Int32>] [-Server <VIServer[]>] [-WhatIf] [-Yellow <Int32>] [-YellowIntervalSeconds <Int32>] [<CommonParameters>]

New-AlarmTrigger [-Confirm] [-EntityStatus {Gray | Green | Yellow | Red | Unknown}] -EntityType <String> [-Server <VIServer[]>] -StateAlarmOperator {Equal | NotEqual | Unknown} -StatePath <String> -Value <String> [-WhatIf] [<CommonParameters>]

New-AlarmTrigger [-Confirm] [-EntityStatus {Gray | Green | Yellow | Red | Unknown}] -EntityType <String> -EventType <EventType> [-Server <VIServer[]>] [-WhatIf] [<CommonParameters>]

New-AlarmTrigger [-Confirm] -EntityType <String> -Metric <Metric> -MetricAlarmOperator {Above | Below | Unknown} [-Red <Int32>] [-RedIntervalSeconds <Int32>] [-Server <VIServer[]>] [-WhatIf] [-Yellow <Int32>] [-YellowIntervalSeconds <Int32>] [<CommonParameters>]

Related Commands

Get-AlarmAction
Get-AlarmActionTrigger
Get-AlarmDefinition
Get-AlarmTrigger
New-AlarmAction
New-AlarmActionTrigger
New-AlarmDefinition
New-AlarmTrigger
Remove-AlarmAction
Remove-AlarmActionTrigger
Remove-AlarmDefinition
Set-AlarmDefinition
Get-Metric
Get-EventType

Detailed Description

This cmdlet adds an alarm trigger to the existing alarm or creates a new alarm trigger. The newly added or created triggers could be Event, Metric, and State. The cmdlet returns the added or created trigger. To specify a server that is different from the default one, use the Server parameter.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
AlarmDefinitionAlarmDefinition[]Specifies the existing alarm to which you want to add the trigger.trueTrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
EntityStatusEntityStatusSpecifies the trigger status. The allowed values for the Metric and State triggers are Red and Yellow.falseFalse
EntityTypeStringSpecifies the type of object on which the event occurs, its containing state or metric. ?he valid PowerCLI type names are Cluster, Datacenter, Datastore, DistributedSwitch, VMHost, VirtualPortGroup, ResourcePool, VirtualMachine, and so on.trueFalse
EventTypeEventTypeSpecifies the event to trigger on. You can find the event types by using the Get-EventType cmdlet.trueTrue (ByValue)
MetricMetricSpecifies the metric to trigger on. You can find the metrics by using the Get-Metric cmdlet.trueTrue (ByValue)
MetricAlarmOperatorMetricAlarmOperatorSpecifies the operation of the target metric.trueFalse
RedInt32Specifies the threshold value that triggers a red status.falseFalse
RedIntervalSecondsInt32Specifies the time interval for which the red condition must be true before the red status is triggered. If unset, the red status is triggered immediately when the red condition becomes true.falseFalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.falseFalse
StateAlarmOperatorStateAlarmOperatorSpecifies the operation of the target state.trueFalse
StatePathStringSpecifies the path of the state property. Supported values for the VirtualMachine type: runtime.powerState, summary.quickStats.guestHeartbeatStatus. Supported values for the VMHost type: runtime.connectionState. And so on.trueFalse
ValueStringSpecifies the condition of the state path.trueFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse
YellowInt32Specifies the threshold value that triggers a yellow status.falseFalse
YellowIntervalSecondsInt32Specifies the time interval for which the yellow condition must be true before the yellow status is triggered. If unset, the yellow status is triggered immediately when the yellow condition becomes true.falseFalse

Return Type

VMware.VimAutomation.ViCore.Types.V1.Alarm.AlarmTrigger

Notes

Examples

-------------------------- Example 1 --------------------------

New-AlarmTrigger  -EventType $eventType -EntityStatus Red -AlarmDefinition $alarm -EntityType "VirtualMachine"

Adds a new event trigger from the $eventType event type to the existing $alarm alarm with status Red to the VirtualMachine entity.

-------------------------- Example 2 --------------------------

New-AlarmTrigger  -EventType $eventType -EntityStatus Red  -EntityType "VirtualMachine"

Creates a new event trigger from the $eventType event type with status Red with the VirtualMachine entity.

-------------------------- Example 3 --------------------------

New-AlarmTrigger  -AlarmDefinition $alarm -Metric $metric -MetricAlarmOperator Above -Red 3200 -RedIntervalSeconds 900 -EntityType "VirtualMachine"

Adds a new metric trigger with a $metric metric and an Above operator for the VirtualMachine entity to the $alarm alarm. The threshold value that triggers a red status is 3200. The time interval for which the red condition must be true before the red status is triggered is 900.

-------------------------- Example 4 --------------------------

New-AlarmTrigger -Metric $metric -MetricAlarmOperator Above -Red 3200 -RedIntervalSeconds 900 -EntityType "VirtualMachine"

Creates a new metric trigger with a $metric metric and an Above operator for the VirtualMachine entity. The threshold value that triggers a red status is 3200. The time interval for which the red condition must be true before the red status is triggered is 900

-------------------------- Example 5 --------------------------

New-AlarmTrigger  -AlarmDefinition $alarm -StatePath "runtime.connectionState" -StateAlarmOperator Equal -Value "connected" -EntityStatus Red -EntityType "VMHost"

Adds a new state trigger to VMHost with status Red to the $alarm alarm. You can activate the trigger when the "runtime.connectionState" state is equal to "connected".

-------------------------- Example 6 --------------------------

New-AlarmTrigger -StatePath "runtime.connectionState" -StateAlarmOperator Equal -Value "connected" -EntityStatus Red -EntityType "VMHost"

Creates a new state trigger to VMHost with status Red. You can activate the trigger when the "runtime.connectionState" state is equal to "connected".


Copyright © VMware, Inc. All rights reserved.