Configuring VMware Run Book Actions

Download this manual as a PDF file

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

VMware Run Book Actions

The "VMware AutomationPowerPack includes the following run book actions, all of which use the "Get VMware Diagnostic Logs" action type to request logs through the VMware vSphere Web Services API:

  • Get All Available VMware Diagnostic Logs
  • Get vCenter Service Logs
  • Get VMware hostd and vCenter Agent ESXi Logs
  • Get VMWare VMKernel Log and Syslog

Each run book action has the following parameters in the Input Parameters field in the Action Policy Editor modal:

  • num_lines. Specifies the number of log lines to retrieve from the logs. The combined total of log lines across all log files in one action is limited to 120 lines before the response output begins to be truncated. As a result, if you use the log_files parameter to specify multiple log files in one action and you try to get more lines from each than is supported, you might see the outputs for each log file get truncated. If you need more lines from a specific log file, you can create a new run book action that specifies only that log file to get the maximum 120 log lines.
  • credential_id. Lets you align a specific SOAP/XML credential or Universal Credential on the SL1 stack with this run book action. You can find the credential ID on the Credentials page (Manage > Credentials), in the ID column. The default value of this field is 0. If you want the action to get credential information from the "VMware: Inventory Cache" Dynamic Application aligned to the device, leave the value as 0.
  • log_files. Specifies the log files you want to collect.

The following run book 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. For more information about input parameter fields, see the table in Creating a VMware Run Book Action.

Run Book Action Description Parameters

Get All Available VMware Diagnostic Logs

Collects all lines in all logs from the vCenter device.

If you run this action used with the log_files parameter set to "log_files":"" (no log files specified), the action will try to capture all the log files that are available on the device.

  • "num_lines":10
  • "credential_id":0
  • "log_files":""

Get vCenter Service Logs

Collects the last 50 lines from the vpxd.log file.

  • "num_lines":50
  • "credential_id":0
  • "log_files":"vpxd.log"

Get VMware hostd and vCenter Agent ESXi Logs

Collects the last 50 lines from the hostd.log file and vpxa.log file.

  • "num_lines":50
  • "credential_id":0
  • "log_files":"hostd.log,vpxa.log"

Get VMware VMKernel Log and Syslog

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

  • "num_lines":50
  • "credential_id":0
  • "log_files":"vmkernel.log,syslog.log"

Creating a VMware Run Book Action

You can create a new run book action that collects certain logs using the "Get VMware Diagnostic Logs" custom action type. You can also use one of the existing run book actions in the PowerPack as a template by using the Save As option.

To create a custom run book action 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 run book action policy request the last 50 lines of the logs from vCenter. Input parameters must be defined as a JSON structure, even if only one parameter is defined.

    The run book actions accept the following parameters in JSON:

    Parameter 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.

  • Click Save, or 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.