You can configure an alarm to run a script or a command when the alarm is triggered.

Before you begin

Required Privilege: Alarms > Create alarm or Alarms > Modify alarm

About this task

Use the alarm environment variables to define complex scripts and attach them to multiple alarms or inventory objects. For example, you can write a script that enters the following trouble ticket information into an external system when an alarm is triggered:

  • Alarm name

  • Object on which the alarm was triggered

  • Event that triggered the alarm

  • Alarm trigger values

When you write the script, include the following environment variables in the script:

  • VMWARE_ALARM_NAME

  • VMWARE_ALARM_TARGET_NAME

  • VMWARE_ALARM_EVENTDESCRIPTION

  • VMWARE_ALARM_ALARMVALUE

You can attach the script to any alarm on any object without changing the script.

Procedure

  1. In the Actions tab of the Alarm Settings dialog box, click Add to add an action.
  2. In the Actions column, select Run a command from the drop-down menu.
  3. In the Configuration column, type script or command information:

    For this type of command...

    Enter this...

    EXE executable files

    Full pathname of the command. For example, to run the cmd.exe command in the C:\tools directory, type:

    c:\tools\cmd.exe.

    BAT batch file

    Full pathname of the command as an argument to the c:\windows\system32\cmd.exe command. For example, to run the cmd.bat command in the C:\tools directory, type:

    c:\windows\system32\cmd.exe /c c:\tools\cmd.bat.

    Note:

    The command and its parameters must be formatted into one string.

    If your script does not make use of the alarm environment variables, include any necessary parameters in the configuration field. For example:

    c:\tools\cmd.exe AlarmName targetName
    c:\windows\system32\cmd.exe /c c:\tools\cmd.bat alarmName targetName
  4. (Optional) : Configure alarm transitions and frequency. See Specify Which Actions to Perform When Triggered.

What to do next

Click OK to save the alarm definition and exit the dialog box, or navigate to a different tab to make further changes.