PowerCLI Reference

New-AlarmAction

Synopsis

This cmdlet creates an alarm action and attaches it to the specified alarm.

Syntax

New-AlarmAction [[-AlarmDefinition] <AlarmDefinition>] [-AlarmActionTrigger <AlarmActionTrigger>] [-Body <String>] [-Cc <String[]>] -Email [-Server <VIServer[]>] [-Subject <String>] -To <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]

New-AlarmAction [[-AlarmDefinition] <AlarmDefinition>] [-AlarmActionTrigger <AlarmActionTrigger>] -Script -ScriptPath <String> [-Server <VIServer[]>] [-Confirm] [-WhatIf] [<CommonParameters>]

New-AlarmAction [[-AlarmDefinition] <AlarmDefinition>] [-AlarmActionTrigger <AlarmActionTrigger>] [-Server <VIServer[]>] -Snmp [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
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 creates an alarm action or attaches an alarm action to the specified alarm.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
AlarmDefinitionAlarmDefinitionSpecifies the alarm definition for which you want to configure actions.falseTrue (ByValue)
AlarmActionTriggerAlarmActionTriggerSpecifies the alarm action trigger. If it is not specified, a default action trigger is created with a Yellow start value and a Red end value.falseFalse
BodyStringSpecifies the text of the email message.falseFalse
CcString[]Specifies the email addresses you want to add to the CC field of the email message.falseFalse
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
EmailSwitchParameterIndicates that when the alarm is activated, the system sends an email message to the specified address. Use the Subject, To, CC, and Body parameters to customize the alarm message.trueFalse
ScriptSwitchParameterIndicates that a script is run when the alarm is activated.trueFalse
ScriptPathStringSpecifies the path to a batch file, located on a vCenter Server system, that will run when the alarm is activated.trueFalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed 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
SnmpSwitchParameterIndicates that a SNMP message is sent when the alarm is activated.trueFalse
SubjectStringSpecifies a subject for the email message you want to send.falseFalse
ToString[]Specifies the email address to which you want to send a message.trueFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

The newly created AlarmAction object

Notes

Examples

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

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Snmp

Creates an alarm action SNMP and attaches it to the specified alarm.

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

New-AlarmAction -Snmp

Creates an alarm action SNMP.

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

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Script -ScriptPath 'c:\test.bat'

Creates an alarm action script and attaches it to the specified alarm.

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

New-AlarmAction -Script -ScriptPath 'c:\test.bat'

Creates an alarm action script.

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

Get-AlarmDefinition -Name "Alarm1" | New-AlarmAction -Email -To 'test@vmware.com' -CC @('test1@vmware.com', 'test2@vmware.com') -Body 'Test body' -Subject 'Test subject'

Creates an alarm action email and attaches it to the specified alarm.

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

-AlarmAction -Email -To 'test@vmware.com' -CC @('test1@vmware.com', 'test2@vmware.com') -Body 'Test body' -Subject 'Test subject'

Creates an alarm action email.


Copyright © VMware, Inc. All rights reserved.