In my recent vCenter Operations Manager projects, I have extensively worked on customizing vCOps for customers to meet the needs of their specific use cases. In one such engagement, I was asked to build up a custom dashboard which shows all the key metrics of a selected object. The use case of this dashboard is to showcase 3 heatmaps, one each for Virtual Machines, ESXi Host and Datastore. These heatmaps would change colors from Green to Red once there fault score changes from 0 to 1. As soon as there is a fault with any of the VMs, Hosts or Datastores the color of the object changes to RED. Later you can click on the object and it will show the key metrics related to that object in the right pane (metric spark-lines). Look at the screenshot below:-
FAULT - METRIC DASHBOARD
Figure 1
This is possible using Heatmap widget on the left which showcases Faults and Metric Sparklines widget on the left. Then an interaction has been set between widgets as sown below in the screenshot.
Figure 2
These interactions are used by setting up the interaction mode in the Metric Sparklines and other similar widgets. Here is a screenshot which shows where the interaction mode is set:-
Figure 3
In the default mode the Interactions Mode shows the metrics which are shown in the above screenshot as soon as you select the object, however the requirement which I got was different.
I was asked to create a custom list of metrics which should be shown as soon as a VM, ESXi Host or a Datastore is selected from the heatmap. To meet this requirement, I had to find a way by which I can set the interaction mode to point towards a custom XML which would then show the desired metrics on the metric spark lines.
The custom-metric.xml which I wrote is shown below along with its description below:-
Figure 4
You can download this file from the following link - https://docs.google.com/file/d/0B9F7kU-3lhdfUWNvRXJTNUR0ejA/edit?usp=sharing
Once you have downloaded this file, you can change the thresholds or define new metrics or objects to solve your use cases. In order to get the details of all the metrics which are available for an object, you can login to vSphere UI and navigate to the operations tab as shown in the screenshot below:-
Figure 5
Your next task would be to upload this xml on the vCOps UI VM . Once it is uploaded we will be able to use this file for interaction instead of Default mode as shown in Figure 3. The path on UI VM where u need to store this -
/usr/lib/vmware-vcops/tomcat-enterprise/webapps/vcops-custom/WEB-INF/classes/resources/reskndmetrics
I will use winscp to move the "custom-metrics.xml" file to the above mentioned location on my UI VM and then give it the exact rights as other existing files which are available in this directory as shown is Figure 6 and Figure 7 below.
Figure 6
Figure 7
Alright, now we just need to edit the dashboard which I showed in Figure 1 and edit all the 3 widgets for VM Sparklines, ESXi Host Sparklines and Datastore Sparklines and click on the drop-down below Res. Interaction Mode to select the brand new interaction option which we just created and uploaded. See the screenshot below and you will notice the new custom-views option which is available now. Make sure to set this interaction mode for all the metric spark-lines widgets on by one.
Figure 8
Once you are done, you need to just select any VM, Host and Datastore in the left pane and now you will see the metrics which you asked for in the custom-views.xml file. See Figure 9 below and compare it with Figure 1 and Figure 4 and you will notice that the metrics shown now are the metrics which you defined in your xml file.
Figure 9
Now this can be really powerful as you can use this customization method to filter the metrics which you want in a dashboard rather than depending upon what is available out of the box. Let me know if you have any questions on this and I will be happy to help you.
Share and Spread the Knowledge.
************Article Update - 27th Oct 2013*************
Another update to the article on the basis of discussions I had with my buddy Lior Kamrat. He has done some great work on vCOps and XMLs. If you have a super metric which you want to capture as an attribute key, you need to use the following format:-
"<Metric attrkey="Super Metric|sm_X" (X as number(ID) of the SM)
************Article Update - 25th Oct 2013*************
Figure 10