Syntax
New-AlarmTrigger -AlarmDefinition <AlarmDefinition> -EntityStatus {Gray | Green | Yellow | Red | Unknown} -EntityType <String> [-Server <VIServer[]>] -StateAlarmOperator {Equal | NotEqual | Unknown} -StatePath <String> -Value <String> [<CommonParameters>]Related Commands
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
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
AlarmDefinition | AlarmDefinition | Specifies the existing alarm to which you want to add the trigger. | true | False | |
EntityStatus | EntityStatus | Specifies the trigger status. The allowed values for the Metric and State triggers are Red and Yellow. | true | False | |
EntityType | String | Specifies the type of object on which the event occurs, its containing state or metric. ?he valid PowerCLI type names are VirtualMachine, VMHost, and so on. | true | False | |
EventType | EventType | Specifies the event to trigger on. You can find the event types by using the Get-EventType cmdlet. | false | True (ByValue) | |
Metric | Metric | Specifies the metric to trigger on. You can find the metrics by using the Get-Metric cmdlet. | false | True (ByValue) | |
MetricAlarmOperator | MetricAlarmOperator | Specifies the operation of the target metric. | true | False | |
Red | Int32 | Specifies the threshold value that triggers a red status. | false | False | |
RedIntervalSeconds | Int32 | Specifies 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. | false | False | |
Server | VIServer[] | 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. | false | False | |
StateAlarmOperator | StateAlarmOperator | Specifies the operation of the target state. | true | False | |
StatePath | String | Specifies 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. | true | False | |
Value | String | Specifies the condition of the state path. | true | False | |
Yellow | Int32 | Specifies the threshold value that triggers a yellow status. | false | False | |
YellowIntervalSeconds | Int32 | Specifies 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. | false | False |
Return Type
VMware.VimAutomation.ViCore.Types.V1.Alarm.AlarmTriggerNotes
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".