Calculating Custom Costs

Commander 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 also configured for VMs and virtual services, the custom cost is also assigned to the deployed VM.

Example: Calculating custom backup costs

In this 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, and click the Cost Models tab.
  2. Select Default from the listed cost models, and click Edit Cost Model.
  3. In the Edit Cost Model dialog, go to the Custom page.
  4. Edit Cost Model

  5. Click the Create a new custom attribute option.
  6. In the Configure Attribute wizard, type "Backup Frequency" in the Name field.
  7. Define Attribute dialog

  8. From Applies To, choose 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.
  9. 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:
  10. "None, Daily, Weekly, Monthly"

    Configure Attribute page

  11. Click Add and then click Finish.
  12. Back on Custom page of the Edit Cost Model wizard, from Select an Attribute to Configure, select Backup Frequency, then click Configure.
  13. In the Custom Costs dialog, select Custom Calculation.
  14. 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 USD per GB

    Add the formulas from the following table:

    Backup Frequency

    Backups to Keep


    Daily (1 full backup plus 6 incremental backups)

    4 weeks

    ((#{} * 4) + (#{} * 0.20 * 24)) * 5


    3 months

    (#{} * 12) * 5


    6 months

    (#{} * 6) * 5

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

    Custom Costs

  16. 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 > Self-Service > Forms.
  2. In the Form Library, select the Default Service form.
  3. Note: When you add a custom calculation to a Service form, Commander 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.

  4. In the Toolbox on the right, click Header to add a text header component to the form.
  5. In the new header service form component, enter "Backup Requirements" in the text field, and select Heading 2 for the style.
  6. Backup Requirements component

  7. Click OK to accept these changes.
  8. In the Toolbox, click the Custom Attribute element to add it to the form.
  9. In the new custom attribute service form component, select Backup Frequency from the Custom Attribute list.
  10. Backup Requirements service

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

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 section of the VM's Summary tab.