New-AlarmAction
This cmdlet creates an alarm action or attaches an alarm action to the specified alarm.
Syntax
-Email
-To <String[]>
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Body <String>]
[-Cc <String[]>]
[-Server <VIServer[]>]
[-Subject <String>]
[CommonParameters]
-To <String[]>
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Body <String>]
[-Cc <String[]>]
[-Server <VIServer[]>]
[-Subject <String>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
SwitchParameter | named |
|
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 |
|
String[] | named |
|
Specifies the email address to which you want to send a message. | optional |
|
AlarmActionTrigger | named |
|
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. | optional |
|
AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. | optional |
|
String | named |
|
Specifies the text of the email message. | optional |
|
String[] | named |
|
Specifies the email addresses you want to add to the CC field of the email message. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. | optional |
|
String | named |
|
Specifies a subject for the email message you want to send. |
-Script
-ScriptPath <String>
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Server <VIServer[]>]
[CommonParameters]
-ScriptPath <String>
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
SwitchParameter | named |
|
Indicates that a script is run when the alarm is activated. | required |
|
String | named |
|
Specifies the path to a batch file, located on a vCenter Server system, that will run when the alarm is activated. | optional |
|
AlarmActionTrigger | named |
|
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. | optional |
|
AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. |
-Snmp
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Server <VIServer[]>]
[CommonParameters]
[-AlarmActionTrigger <AlarmActionTrigger>]
[-AlarmDefinition <AlarmDefinition>]
[-Server <VIServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required |
|
SwitchParameter | named |
|
Indicates that a SNMP message is sent when the alarm is activated. | optional |
|
AlarmActionTrigger | named |
|
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. | optional |
|
AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. | optional |
|
VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. |
Output
VMware.VimAutomation.ViCore.Types.V1.Alarm.AlarmAction
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.
Related Commands
AlarmAction
This cmdlet retrieves the actions of the specified alarm definitions.
This cmdlet removes an alarm action.
This cmdlet creates an alarm action and attaches it to the specified alarm.
AlarmActionTrigger
This cmdlet retrieves the actions that trigger the specified alarm actions.
This cmdlet removes the alarm action triggers.
This cmdlet creates a new action trigger for the specified alarm action.
AlarmDefinition
This cmdlet retrieves the available alarm definitions.
This cmdlet modifies the specified alarm definitions.
This cmdlet removes alarm definitions from the vSphere environment.
This cmdlet creates a new alarm definition.
AlarmTrigger
This cmdlet retrieves alarms triggers.
This cmdlet adds ? new alarm trigger to the existing alarm or creates ? new alarm trigger.