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]

Parameters

Required Parameter Name Type Position Features Description
required
Email
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
  • pipeline
  • 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
    Server
    VIServer[] named
  • wildcards
  • 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.

    -Script
    -ScriptPath  <String>
    [-AlarmActionTrigger  <AlarmActionTrigger>]
    [-AlarmDefinition  <AlarmDefinition>]
    [-Server  <VIServer[]>]
    [CommonParameters]

    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
  • pipeline
  • Specifies the alarm definition for which you want to configure actions.
    optional
    Server
    VIServer[] named
  • wildcards
  • 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]

    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
  • pipeline
  • Specifies the alarm definition for which you want to configure actions.
    optional
    Server
    VIServer[] named
  • wildcards
  • 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

    Feedback

    Was this page helpful?