4.36 VmPowerStatus

Use this Knowledge Script to monitor changes in the power status of virtual machines. This script raises an event if a virtual machine is powered on, powered off, or suspended. Based on these events, you can choose to restart, stop, or resume the monitored virtual machines.

NOTE:

  • If the parent host of the monitored virtual machine is in maintenance mode, this Knowledge Script will not generate events.

  • Using this script and other VirtualCenter_Vm* scripts to monitor a large number of virtual machines at the same time might cause the jobs to fail. If the jobs fail on a regular basis, consider running the VirtualCenter_Vm* scripts on fewer virtual machines.

4.36.1 Prerequisite

Enable Power On, Power Off, Suspend, and Restart permissions to run this Knowledge Script. For more information, see the “Installing AppManager for VMware vSphere” chapter in the AppManager for VMware vSphere Management Guide.

4.36.2 Prerequisite

Enable Power On, Power Off, Suspend, and Restart permissions to run this Knowledge Script. For more information, see Section 2.10, Upgrading Knowledge Script Jobs.

4.36.3 Resource Object

vSphere virtual machine

4.36.4 Default Schedule

By default, this script runs every 15 minutes.

4.36.5 Setting Parameter Values

Set the following parameters as needed:

Parameter

How to Set It

Event Notification

Raise event when virtual machine is powered on?

Select Yes to raise an event when a virtual machine is in the “powered on” state. The default is Yes.

Event severity when virtual machine is powered on

Set the event severity level, from 1 to 40, to indicate the importance of an event in which a virtual machine is in the “powered on” state. The default is 15.

Raise event when virtual machine is powered off?

Select Yes to raise an event when a virtual machine is in the “powered off” state. The default is Yes.

Event severity when virtual machine is powered off

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the virtual machine is in the “powered off” state. The default is 15.

Raise event when virtual machine is suspended?

Select Yes to raise an event when a virtual machine is in “suspended” state. The default is Yes.

Event severity when virtual machine is suspended

Set the event severity level, from 1 to 40, to indicate the importance of an event in which a virtual machine is in “suspended” state. The default is 15.

Raise event when status information is not available?

Select Yes to raise an event when information about the virtual machine’s connection status is not available. The default is unselected.

Event severity when status information is not available

Set the event severity level, from 1 to 40, to indicate the importance of an event in which information about the virtual machine’s connection status is not available. The default is 15.

Event severity when AppManager failed to get metrics

Set the event severity level, from 1 to 40, to indicate the importance of an event in which AppManager failed to retrieve metrics from vCenter. The default is 15.

Event severity when AppManager failed to log in

Set the event severity level, from 1 to 40, to indicate the importance of an event in which AppManager failed to log in to vCenter. The default is 5.

Event severity when VmPowerStatus job fails unexpectedly

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the VmPowerStatus job fails unexpectedly. The default is 5.

Actions

When a powered on event is raised, perform this action

Choose to power off, suspend, or take no action when an event is raised because the virtual machine is in “powered on” state. The default is no action.

When a powered off event is raised, perform this action

Choose to power on or take no action when an event is raised because the virtual machine is in “powered off” state. The default is power on.

When a suspended event is raised, perform this action

Choose to resume or take no action when an event is raised because the virtual machine is in “suspended” state. The default is no action.