Introducing VMware vCenter Chargeback API

Chargeback is an important feature for computing infrastructures. Even inside an enterprise where IT users are not charged with real money, it’s still nice to see the usage patterns and sometimes avoid wasting resources. As I mentioned in IBM RC2, applying chargeback reduced unnecessary usage overnight.

VMware vCenter Chargeback is a component for this purpose. It can run standalone with Web GUI, and surface to vSphere Client as a plug-in. Although its name includes vCenter, it can also work with vCloud Director (see Using vCenter Chargeback with VMware Cloud Director).

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

I just spent some time over the weekend reading the API documentation, including vCenter Chargeback API Programming Guide, API Reference. The version 1.5 of the API covers Administration, Cost Management, Hierarchy Management, Report Management, User Management, Event Management, and Search. You can use API for pretty much everything you can do with the Chargeback GUI.

While reading the API docs, I found it’s not good idea to jump onto the API doc without knowing the key concepts used in the chargeback. This is a good example where you’d better know a product first before learning its APIs. Here is the User’s Guide you want to read in parallel and cross-reference.

Two key concepts that I think represent a little learning curve in the chargeback API are:

Chargeback Hierarchy

This is a tree structure that defines a scope for chargeback. It may or may not the same structure as vCenter inventory. I find the following description from User’s Guide very helpful.

A chargeback hierarchy is an organization of vCenter Server entities and vCenter chargeback entities. The vCenter Server entities include virtual machines, ESX Server hosts, data centers, resource pools, host folders, and virtual machine folders. A chargeback hierarchy can contain entities from more than one vCenter Server. The vCenter Chargeback entities are custom entities that could represent a logical parent for the vCenter Server entities. For example, the vCenter Chargeback entities could represent the departments, cost centers, or business units in an organization. A vCenter Chargeback entity can contain one or more vCenter Server entities and vCenter Chargeback entities.

Cost Elements

These elements define the logic to calculate the cost to be charged. They include:

a. Chargeable computing resources: like CPU, memory, net bandwidth, storage, etc.

b. Base rate: a global rate that you charge for a unit of chargeable computing resource used, reserved, or allocated for a specific duration.

c. Fixed cost: a definite cost that can be charged on an entity. Fixed costs can be recurring costs or non-recurring or one-time costs.

d. Billing policy: determines the cost types and the amount of chargeable computing resources units to be considered for calculating the chargeback cost

e. Cost model: defines base rates for the chargeable computing resources, the currency, the billing policy to be used for calculating the total cost, and special costs, such as cost for the guest operating system installed on the virtual machine. A cost model also enables you to define different billing policies for different time periods.

Once you understand these concepts, others like user/role/report/event are straight-forward therefore not introduced here.

The REST API is very easy in the sense that it just CRUD (create, read, update, delete) these resources behind the key concepts. You can read the programming guide and API reference for more details.

This entry was posted in Virtualization and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.