Customizing VMware Automation Actions

Download this manual as a PDF file

This section describes how to customize the automation actions included in the VMware Automation PowerPack to create automation actions to meet your organization's specific requirements.

Creating a Custom Action Policy

You can use the "Get VMware Diagnostic Logs" action type included with the VMware Automation PowerPack to create custom automation actions that you can then use to build custom automation policies.

To create a custom action policy using the "Get VMware Diagnostic Logs" action type:

  • Navigate to the Action Policy Manager page (Registry > Run Book > Actions).
  • In the Action Policy Manager page, click the Create button.
  • The Action Policy Editor modal appears.

  • In the Action Policy Editor page, supply a value in each field.
  • Action Name. Specify the name for the action policy.
  • Action State. Specifies whether the policy can be executed by an automation policy (enabled) or cannot be executed (disabled).
  • Description. Allows you to enter a detailed description of the action.
  • Organization. Organization to associate with the action policy.

  • Action Type. Type of action that will be executed. Select the "Get VMware Diagnostic Logs" action type.
  • Execution Environment. Select from the list of available Execution Environments. The default execution environment is System.
  • Action Run Context. Select Database or Collector as the context in which the action policy will run.
  • Input Parameters. A JSON structure that specifies each input parameter. Each parameter definition includes its name, data type, and whether the input is optional or required for this Custom Action Type. In the example shown above, the automation action policy request the last 50 lines of the authentication log from vCenter.

Input parameters must be defined as a JSON structure, even if only one parameter is defined.

  • Click [Save]. If you are modifying an existing action policy, click Save As. Supply a new value in the Action Name field, and save the current action policy, including any edits, as a new policy.

Customizing Automation Actions

The VMware Automation PowerPack includes two automation actions that use the "Get VMware Diagnostic Logs" action type to request logs through the VMware vSphere Web Services API. You can specify the host and the options in a JSON structure that you enter in the Input Parameters field in the Action Policy Editor modal.

The following automation actions that use the "Get VMware Diagnostic Logs" action type are included in the VMware Automation PowerPack. Compare the commands run with the example in the image above.

Action Name Description Commands Run

Get VMware VMKernel Log and Syslog

Collects the last 50 lines from the vmkernel.log file and the syslog.log file.

  • num_lines 50
  • log_files vmkernel.log,syslog.log

Get VMware Diagnostic Logs

Collects all lines in all logs from the vCenter appliance.

  • num_lines {empty}
  • log_files {empty}

Creating a VMware Automation Action

You can create a new automation action that collects certain logs using the “Get VMware Diagnostic Logs” custom action type. To do this, select “Get VMware Diagnostic Logs” in the Action Type drop-down list when you create a new automation action. You can also use the existing automation actions in the PowerPack as a template by using the [Save As] option.

The automation actions accept the following parameters in JSON:

Paramter Input type Description
num_lines integer Specifies the number of log lines to return.
credential_id integer

Default value: 0

Specifies the credential_id to use for the connection.

  • If set to 0 (false), the custom action type will dynamically determine the credential by using the credential aligned to the "VMware: Inventory Cache" Dynamic Application on the root device associated with the device triggering the event.
  • If set to an ID number, it maps to the credential ID specified. You can find credential IDs by going to System > Manage > Credentials.
log_files string

Default value: none

Specifies the log files you want to collect.