New-AlarmAction
This cmdlet creates an alarm action or attaches an alarm action to the specified alarm.
Syntax
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
|
To | String[] | named |
|
Specifies the email address to which you want to send a message. |
optional | AlarmActionTrigger | 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 | AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. |
optional | Body | String | named |
|
Specifies the text of the email message. |
optional | Cc | String[] | named |
|
Specifies the email addresses you want to add to the CC field of the email message. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | 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 | Subject | String | named |
|
Specifies a subject for the email message you want to send. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Script | SwitchParameter | named |
|
Indicates that a script is run when the alarm is activated. |
required
|
ScriptPath | 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 | 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 | AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | 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. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Snmp | SwitchParameter | named |
|
Indicates that a SNMP message is sent when the alarm is activated. |
optional | AlarmActionTrigger | 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 | AlarmDefinition | named |
|
Specifies the alarm definition for which you want to configure actions. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | 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.AlarmActionExamples
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 '[email protected]' -CC @('[email protected]', '[email protected]') -Body 'Test body' -Subject 'Test subject'
Creates an alarm action email and attaches it to the specified alarm.
Example 6
-AlarmAction -Email -To '[email protected]' -CC @('[email protected]', '[email protected]') -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 creates an alarm action and attaches it to the specified alarm.
This cmdlet removes an alarm action.
AlarmActionTrigger
This cmdlet retrieves the actions that trigger the specified alarm actions.
This cmdlet creates a new action trigger for the specified alarm action.
This cmdlet removes the alarm action triggers.
AlarmDefinition
This cmdlet retrieves the available alarm definitions.
This cmdlet creates a new alarm definition.
This cmdlet removes alarm definitions from the vSphere environment.
This cmdlet modifies the specified alarm definitions.
AlarmTrigger
This cmdlet retrieves alarms triggers.
This cmdlet adds ? new alarm trigger to the existing alarm or creates ? new alarm trigger.
AlarmTriggerArgument
This cmdlet creates a new AlarmTriggerArgument local object that defines the condition comparison under which an alarm is triggered. The AlarmTriggerArgument object is used as the Arguments parameter in the New-AlarmTrigger cmdlet.
AlarmTriggerArgumentAttributeName
This cmdlet fetches a list of attribute names of the alarm trigger argument for the "vsan.health.ssd.endurance" event type. (The most of attribute names for alarm trigger argument can be fetched by Get-EventType)