vROps 6, Supermetrics, and editing XML

How to find the metric description you can use for metric configuration in XML files. As with vROps 6 the way to retrieve the metric names from v5 doesn’t work anymore. This document explains how to utilize the REST API (Suite API) to achieve what some starting to struggle with. The word ‘Lab:’ in this document reference what steps I performed in my lab. The following flow-chart explains the high-level steps involved to present your Super Metric onto a Dashboard:

Lab Setup: Custom Group

In my lab I created the following:  

  • Custom Group
    • Name: Lab Desktops
    • Group Type: Environment
    • Policy: Default Policy
    • Membership criteria:
      • Criteria: VDI Desktop Pool


Lab Setup: Super Metric

Objective: For my testing I am determining the capacity used for a View Pool


  Super Metric creation and testing steps:

  • In section (1) of this picture you will enter your Super Metric formula or build your Super Metric based on the Adapter Type, Objects, Object Types, Metrics, Attribute types.
  • Once you complete your formula select (2) (blue play icon) to test your formula.
  • After testing your formula’s syntax window (3) will populate with the short-form formula.
  • Select (4) (the graph icon) to test the Super Metric. Note: You may need to select a timeframe to see results (see picture on next page for an example.)

 

 

 

My formula: sum(${this, metric=desktop_vms|pool_capacity_used})   Example of executing a Super Metric through the graph icon: 

Lab Setup: New Policy

My next step is to create new or modify a policy to make sure the Super Metric is active for the objects you want it to be assigned for.

Note: After assigning a Super Metric to a policy it should take 2 cycles (10 minutes) maximum till the Super Metric is visible and accessible via the “All Metrics” tab below troubleshooting. Assuming the related metrics are collected in 5min interval either.

  • Name: Lab Policy
  • Base Policy: vSphere Solution’s Default Policy
  • Override Attributes
    • Super Metric|vdi_pool_capacity
      • Type: Super Metric
      • Adapter Type: All Adapter Types
      • Object Type: All Object Types
      • State: Local
      • KPI: Inherited
    • Super Metric|vdi_pool_capacity
      • Type: Super Metric
      • Adapter Type: View Adapter
      • Object Type: VDI Desktop Pool
      • State: Local
      • KPI: Inherited
  • Apply policy to Group
    • Lab Desktops

Creating a custom XML file

  Create a copy of the appropriate XML file; do NOT edit canned XML files.

  • Copy XML process
    • Select the canned XML file
    • Select the pencil to edit
    • Select all contents (Ctrl-A) and copy into clipboard (Ctrl-C)
    • Click Cancel to stop editing the canned XML
    • Open your web browser to the following URL
      • http://codebeautify.org/xmlviewer
      • Past the XML contents into the XML input field and select the middle button ‘Beautify’
      • Select the two layered notebooks in the upper right or copy the contents in the Result dialog to clipboard
    • Select the green ‘+’ to add a new XML file
    • Enter the name of your new XML

Lab: In my lab we will call this file lab_desktop.xml

  • Past the newly formatted contents into the XML file

  Note: The next steps outline the process to inject a Super Metric into an XML. One requirement that should be identified is the internal name for the metric (Super metric) is required. There is a 2-way process.

  • Retrieve resource with resource identifier.
  • Use the resource identifier to retrieve resource metrics and their names

Retrieving your object’s identifier ID (API Call #1)

  Navigate to the following location:

  • From Home select Environment
  • Select
    • Inventory Tree that pertains to your Super Metric, or
    • All Objects and drill into the needed object or
    • Your custom group
  • Select your object under ‘Related Objects’
  • Click the ‘Troubleshooting’ tab
  • Select ‘All Metrics’
  • Find your needed object

Lab: “Lab Desktops” icon, i.e. our object

  • Open a new tab/browser window and navigate to the following URL:
    • https://<your vrops server>/suite-api/api/resources?regex=.*<Your object>.*

Lab: https://172.16.0.19/suite-api/api/resources?regex=.*Lab%20Desktops.*

 

Note: You can use the complete name or just a fraction. With “.*” at the beginning/end we make sure that we have not missed something. You should see a similar output dump to the following screenshot:

  • Verify the name of the object is correct

Lab: ‘Lab Desktops’.

  • Copy the identifier ID, you will use this for the next step

Retrieving your metric description (API Call #2)

Open a new tab/browser window and navigate to the following URL:

  • https://<your vrops server>/suite-api/api/resources/<your object identifier ID>/statkeys

 

Lab: https://172.16.0.19/suite-api/api/resources/31522d45-63d4-4d8c-b97a-8bae419a9fd5/statkeys  

 

You should see a similar output dump to the following screenshot:  Scroll until you find your Super Metric identifier ID. This is the name of the metric we are going to use for the interactive widget and the xml definitions.   Navigate to:

  • Administration
  • Manage Metric Config (two down from Super Metrics in the left panel)
  • Expand the tree ReskndMetric

Modify your XML file

  Modify your new XML file to reflect your Super Metric:

  • Find the section that has the ResourceKind that pertains to your Super Metric.

Lab: In our example we need ‘ViewPool’

  • Copy an existing line and past it, example shown below:

 

Modify your new string to match your requirements for the super metric. Lab:

  • <Metric red=”90″
  • orange=”85″
  • yellow=”75″
  • unit=”%”
  • label=”vdi_latency” (common name of your Super Metric goes here)
  • attrkey=”Super Metric|sm_b896a92d-657f-4cb2-b550-8ed4ff1526b6″ /> (past your Super Metric identifier ID in this section.)

Select ‘Save’   Verify your policy has the Super Metric setup in the overrides section.

Update your widget

  Navigate to:

  • Home
  • Dashboard List drop-down
  • Select your custom dashboard

  Edit Object Metric Charts widget

  • In the ‘Metric Configuration’ section
    • Use the drop-down and select your custom XML file from the list

Lab: ‘lab_desktop’

  • Select Save

Validate your XML changes

  Navigate to:

  • Home
  • Dashboard List drop-down
  • Select your custom dashboard

Lab: ‘Lab Dashboard’

  • In your View Sessions widget, select a VDI session

Lab: my session is mydomain\myuseraccnt

  • In your Session Related Objects widget, select a desktop pool

Lab: admin_vm pool   Your Object Metric Charts widget should update with the new Super Metric. You may need to wait a few cycles before the data is updated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: