Embotics® vCommander® allows you to use formulas to create custom cost calculations. List-type custom attributes are used to apply these cost calculations. When you add a custom cost attribute to a cost model and then assign a value for the attribute to a VM, template or virtual service covered by that cost model, the custom cost is included in the total cost for the service.

When you also add the custom cost attribute to a request form, user selections provide input to the calculation, so that the custom cost is added to the displayed cost of the requested service. If the custom cost attribute on the form is configured to apply to VMs and Virtual Services as well as to forms, then the custom cost is also assigned to the deployed VM.

Example: Calculating custom backup costs

In this very simple example, we want to allow users to specify the backup frequency for requested services. We want to include the cost of backups in the total service cost, so that users are aware of the added cost when requesting a service, and so that the cost is included in the VM billing records.

First, we need to edit the cost model to include a custom attribute that will calculate backup cost based on frequency. Next, we need to edit the VM request form to allow users to specify the backup frequency required for the requested service.

Add custom calculations to the cost model

We'll add the custom calculation for each selectable backup frequency to the default private cloud cost model (named Default).

1.Go to Configuration > Costs, select the Default, and click Edit Cost Model.

2.Skip to the Custom page.

Edit Cost Model

3.Click the Create a new custom attribute option.

4.In the Configure Attribute wizard, type "Backup Frequency" in the Name field.

Define Attribute dialog

5.For Applies To, leave the default selection, All Types, so that this attribute can be applied to VMs and Virtual Services as well as added to the request form, then click Next.

6.On the Configure Attribute page, you can enter a comma-separated list of values that users can select on the form (or that can be applied to an existing VM). Enter the following in the text field:

"None,Daily,Weekly,Monthly"

Configure Attribute page

7.Click Add and then Finish.

8.Back on Custom page of the Edit Cost Model wizard, from Select an Attribute to Configure, choose Backup Frequency, then click Configure.

9.In the Custom Costs dialog, select Custom Calculation.

10.Enter a formula for each value. You can use parentheses as well as the following operators:

+ - * /

For simplicity, we're assuming that:

expected incremental backup size is 20% of total backup size

backup storage costs $5/GB

Add the formulas from the following table:

Backup Frequency

Backups to Keep

Formula

Daily (1 full backup plus 6 incremental backups)

4 weeks

((#{target.storage.gb} * 4) + (#{target.storage.gb} * 0.20 * 24)) * 5

Weekly

3 months

(#{target.storage.gb} * 12) * 5

Monthly

6 months

(#{target.storage.gb} * 6) * 5

See Using variables in custom cost calculations below for more information.

NotePencil-smallClicking vars-20x20 in any text field that supports variables opens the Variable Assistant, which allows you to select variables for the current context and provides help for each variable.

Here's what it looks like when we enter the formulas:

Custom Costs dialog

11.Click OK, and then click Finish to exit the cost model wizard.

Add a control to the request form

Now we'll add the new custom attribute to the request form, so that users can specify the backup frequency when requesting a new service.

1.Go to Configuration > Service Request Configuration > Form Designer.

2.In the Form Library, select the Default Service form.

NotePencil-smallWhen we add a custom calculation to a Service form, vCommander totals all costs for that custom attribute for all components in the service. You can also add a custom calculation to a VM or Virtual Service form.

3.In the Toolbox on the right, click Header to add a text header, enter "Backup Requirements" in the text field, and from Style, choose Heading 2.

cost-calc-form-hdr

4.Click OK to accept these changes.

5.In the Toolbox, click the Custom Attribute element to add it to the form.

6.From the Custom Attribute list, choose Backup Frequency.

cost-calc-form-bkp

7.Click OK and Save.

Test the Calculation

To test the calculation for new requests, click Preview. When you specify a value for Backup Frequency on the form, the cost in the pie chart should update accordingly.

Pie Chart with Backup Costs

To test the calculation on an existing VM, navigate to a VM covered by the cost model you configured, right-click it, and select Lifecycle Management > Set Custom Attributes. Select a value and click OK. The cost of the VM should increase accordingly. (To view a VM's cost, click the Details link next to Annual Cost in the Details pane of the VM's Summary tab.)

Using variables in custom cost calculations

The variables supported in custom cost calculations are context-aware, meaning that you can use them to calculate costs at request time as well as for existing VMs and virtual services. For existing VMs and virtual services, the cost is retrieved from the nightly billing record.

NotePencil-smallClicking vars-20x20 in any text field that supports variables opens the Variable Assistant, which allows you to select variables for the current context and provides help for each variable.
NotePencil-smallIf any variables in the formula are undefined, the custom cost calculation will not be included in the VM cost.