< Back

New-AlarmAction

Sun Jan 19, 2020 6:58 pm

NAME 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>]





DESCRIPTION

This cmdlet creates an alarm action or attaches an alarm action to the specified alarm.





PARAMETERS

-AlarmDefinition <AlarmDefinition>

Specifies the alarm definition for which you want to configure actions.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-AlarmActionTrigger <AlarmActionTrigger>

Specifies 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Body <String>

Specifies the text of the email message.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Cc <String[]>

Specifies the email addresses you want to add to the CC field of the email message.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Email [<SwitchParameter>]

Indicates 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.



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Script [<SwitchParameter>]

Indicates that a script is run when the alarm is activated.



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ScriptPath <String>

Specifies the path to a batch file, located on a vCenter Server system, that will run when the alarm is

activated.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Server <VIServer[]>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Snmp [<SwitchParameter>]

Indicates that a SNMP message is sent when the alarm is activated.



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Subject <String>

Specifies a subject for the email message you want to send.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-To <String[]>

Specifies the email address to which you want to send a message.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

If 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

The newly created AlarmAction object







NOTES









-------------------------- 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.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... ction.html

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