In the transition to private cloud computing, Chargeback is becoming one key property that differentiates a highly virtualized environment from one that offers a true private cloud. Whether you plan to formally bill folks for their usage of the environment or simply perform some kind of “showback” or “shadow billing” (how much would it cost?), you need to be able to create dashboards that reflect those costs.
There are a few typical ways that we can potentially charge for computing resources:
- Fixed – The most simple method is to charge some fixed cost per Virtual Machine, this approach is easy to understand, and likely most similar to any chargeback that may have occurred for physical servers.
- Allocation – This method charges based on the resources allocated to a Virtual Machine such as the number of vCPUs, memory or storage space allocated.
- Usage – The most sophisticated, charge based on the resources that are actually being used or consumed such as CPU cycles, memory and storage consumption, and/or network and storage IO.
- Combo – An arbitrary combination of the previous 3 methods
Creating a Chargeback or Showback Dashboard
So how do you create widgets and dashboards in Virtualization Manager to track these costs? Fortunately, since Virtualization Manager is built upon a search based platform, you have a tremendous amount of flexibility to model all of the above scenarios.
Let’s take a simple scenario – we want to charge based on the amount of memory allocated to a VM nd the amount of storage being used – note that the storage used by a VM could be different to what it has been allocated if you are using thin provisioning for example. We’ll assume $25 per GB of memory and $10 per GB of storage space. To do this, we’re going to use a feature called “Trends” – Trends are simply a search that runs on a schedule and plots the result on a graph.
To start with we search for all of our VMs and hit the “Trend” button – this will take us into the trend configuration screen
On the trend configuration screen, we want to plot out the cost based on allocated memory so we’ll select that we want this trend to be based on an attribute. If we click on the find button, type in “memory” and the attribute we want should come right up, the memory configured/allocated for the VM.
Memory is stored in MB so we’ll need to divide by 1024 to get it into GB and multiply by $25 for each GB to get it into dollars (you can put any Xpath supported operation in here which is where the “div” for divide comes from) – we want to show the results in $ (units of “currency”) and we’re going to get a total (aggregation function of “total”) across all VMs in our search. At any point, you can hit the “preview” button to get a sanity check of your calculation.
Finally, let’s mix this up a bit. In many companies, folks are using Folders and/or Resource Pools within vSphere to group VMs by owner, department, project, line of business etc…. Since Virtualization Manager collects the Folder and Resource Pool membership and makes them searchable, we can “segment” our trend, or get a cost by folder or resource pool. We’ll break our cost down by resource pool and run that preview one more time. Looks good – let’s save it.
Let’s go ahead and do the same thing for the storage space used – we’ll skip the intermediate steps.
Now we can add these trends to our dashboard and we’re good to go. Don’t forget that any widget on the dashboard can be simply shared into a Sharepoint or other portal, simply right click on the top of the widget to get a URL.
EC2 Cloud Cost Estimator
Finally if you need some more examples, check out the EC2 Cloud Cost Estimator dashboard that estimates what it would cost to run your VMs on Amazon EC2.
Cloud Cost Estimator Dashboard