This topic provides an example of how to configure a command workflow to back up a VM, set the VM backup time, and send an email to notify the VM owner of the VM back up and the time it occurred.
Through creating the custom attribute and the command workflow, you'll see how to:
- Run a script through a workflow.
- Set VM metadata using the output from a script step.
- Set up email notification through a workflow.
- Use variables to populate email addresses for notification.
The following steps are similar for all workflow types.
Create a custom attribute
Before creating the workflow, create a custom attribute to store the VM's last backup time. You'll set a value for the custom attribute in a workflow step.
- Click Configuration > Custom Attributes, and click Add.
- In the Configure Custom Attribute wizard, enter a name for the attribute, such as "Last Backup Time".
These custom attributes can be displayed on the Details panel of the VM's Summary tab, so you should create user-friendly names.
- Select the Inventory attribute type.
- Select the Text input type.
- Specify that the custom attribute applies to Services, and click Next.
- On the Configure Attribute page, leave the default selection, and click Finish.
Create a command workflow
- Go to Configuration > Command Workflows.
- Click Add to create a new workflow.
- On the Name & Type page, do the following:
- Type a name for the workflow.
- From Target Type, leave the default value of VM.
- Click Next.
Last Backup Time), type the following value:
This syntax uses the output of Step 1 in the workflow to input a value for the custom attribute.
<a> tag is automatically added to links in emails (only the HTTP protocol is supported). For example, if the value of a custom attribute is a link, the value will be formatted as a link in the email.
If you don't use HTML markup in the email body, the body is assumed to be plain text;
<p> tags are automatically added for new lines. If you add HTML markup to the email body, however, no additional tags are added.