You can run a script when an alarm triggers by configuring a command alarm action.

Required privilege: Alarm.Modify Alarm

Note

Alarm commands run in other processes and do not block vCenter Server from running. They do, however, consume server resources such as processor and memory.This procedure assumes you are adding the alarm action to an existing alarm.

This procedure assumes you are adding the alarm action to an existing alarm.

1

If necessary, open the Alarm Settings dialog box.

a

Select the object in the inventory on which the alarm is set.

b

Click the Alarms tab.

c

Click Definitions.

d

Double-click the alarm in the list.

2

Click the Actions tab.

3

Click Add.

4

Double-click the default action and select Run a command.

5

Double-click the Configuration field and do one of the following, depending on the command file type:

If the command is a .exe file, enter the full pathname of the command. For example, to run the cmd.exe command in the C:\tools directory, type:c:\tools\cmd.exe.

If the command is a .bat file, enter the 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.

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

For .bat files, the command and its parameters must be formatted into one string.

6

Click OK.

When the alarm triggers, the action defined in the script is performed.