Import Azure machine and metrics into vROps

Hey Hey,

This has been a long time coming, its been something I have had to implemented at multiple customer sites but have never gotten around to posting about. Since its close to Christmas and everything is calming down. I have a spare minute to put a post together.

I have been asked many times about Azure and vROps and how combine the two. using Hyperic and EPOps we can monitor servers across clouds, but it just comes across as a windows or Linux machine. What makes this better is actually having Azure objects, and then we can create a relationship between the Azure Object and the Hyperic/EPOps object to give a better all-round experience.

This post here is purely on pulling down our Azure machines and the Azure metrics and placing them into vROps.
I have created a video on this here as I feel I can get more across in a video, a step by step blog post would be a novel, but I have also done up a quick overview below with attached images.

The workflows and scripts are available to download towards the bottom of this post.

1) First we need to setup our REST host and operations to point to our vROps instance.
Show in the below image set URL as https://IPorFQDN and do not set authentication as we will be using tokens.
resthost

2) Now create the following Operations
Aquire Token – URL /suite-api/api/auth/token/aquire
operation - aquire token

Insert New Element – URL /suite-api/api/resources/adapterkinds/OPENAPI
operation - insert new element

Add Metrics – URL /suite-api/api/resources/{elem_id}/stats
operation - add metrics

Add Properties – URL /suite-api/api/resources/{elem_id}/properties
operation - add properties

Get Resource – URL /suite-api/api/resources/?name={name}&adapterKind={adapterKind}
operation - get resource

3) We need to make sure powershell host is configured and attached in vROps, this is where the powershell script will be executed from.
powershell host

4) Make sure the Azure account you are using is an Azure AD account not your @live.com address has to be something like an .onmicrosoft.com account

5) Import the package and setup the workflows with your details and fill in the Azure vROps configuration Item as shown in the below images.
configurationitem
change azure subscription login details.
workflow01

Also Add in your vROps user name and password for the token workflow
tokenpass

6) Run the workflow – hopefully everything works.
run

We have a look in vROPs and I can see my 3 machines from the subscription I was targeting.
azure
vropsazure machines

Files


Properties Object Layout.

The workflow “add resource to vROps”, “add metrics” an “add properties” are generic and can be used to add any resource into vROps.

They take a properties format which is

propertyObject.resourcename “name of the object in this case Azure Machine”
propertyObject.resourceKey “object type this case AzureVM”
propertyObject.adapterKindKey “This case OPENAPI”
propertyObject.description “general discription”
propertyObject.metric “Array of metrics and properties”
propertyObject.Identifier “the vROPs ID: the add resource to vROps workflow will add this in either from creating a new object or searching for it, if it exists.”

Metric array format for above:
name “metric name eg CPU|usage”
value “value of the above metric”
Metric “true/false true it’s a metric false it’s a property”

Example is:
var inputArray = new Array();
var temparray = new Array();
var tempprop = new Properties();
var subprop = new Properties();

tempprop.put("resourceName", item.getProperty('VMName'));
tempprop.put("resourceKey","AzureVM");
tempprop.put("adapterKindKey","OPENAPI");
tempprop.put("resourceDescription","Azure VM");

subprop.put("name","CPU|Average Percentage");
subprop.put("value",item.getProperty('CPUAverage'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Disk|DiskReadBytessec");
subprop.put("value",item.getProperty('DiskReadBytessec'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Disk|DiskReadBytessec");
subprop.put("value",item.getProperty('DiskWriteBytessec'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Net|NetworkOut");
subprop.put("value",item.getProperty('NetworkOut'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Net|NetworkIn");
subprop.put("value",item.getProperty('NetworkIn'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Power|Status");
subprop.put("value",item.getProperty('PowerStatus'));
subprop.put("metric","true");
temparray.push(subprop);

var subprop = new Properties();
subprop.put("name","Subscriptionname");
subprop.put("value",item.getProperty('SubscriptionName'));
subprop.put("metric","false");
temparray.push(subprop);
tempprop.put("metric",temparray)

inputArray.push(tempprop);

Cheers.

2 Replies to “Import Azure machine and metrics into vROps”

  1. Hi,

    Trying to follow the steps and while running the workflow I am getting an error saying:
    2017-07-05 18:56:27.480] [E] Error in (Workflow:Get Azure RM Metrics and publish to vROps / Generate Array of Metrics (item1)#12758) TypeError: Cannot call method “getRootObject” of null
    [2017-07-05 18:56:27.506] [E] Workflow execution stack:
    ***
    item: ‘Get Azure RM Metrics and publish to vROps/item1’, state: ‘failed’, business state: ‘null’, exception: ‘TypeError: Cannot call method “getRootObject” of null (Workflow:Get Azure RM Metrics and publish to vROps / Generate Array of Metrics (item1)#12758)’
    workflow: ‘Get Azure RM Metrics and publish to vROps’ (accc3ed9-3f19-4a5c-9729-32c7a1bfec0d)

    Is there any specific PowerShell module that I need to add in my PowerShell host in able to run it successfully. Right now I have 2 Azure module available which are AzureRM.Compute and AzureRM.Profile.
    Hope to get guidance on this.

    Thanks
    Joanne

  2. Hey Joanne,

    That error is basically telling me that there was no return from the powershell script. var items = output.getRootObject() output being the powershell return which in your case must be empty.

    If you run the script manually with the right parameters does it work and display all the machines and metrics?

    Cheers

Leave a Reply

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

*

Anti SPAM BOT Question * Time limit is exhausted. Please reload CAPTCHA.