Connect Aria Operations to the World.

I think it is a sign of the maturity of Aria Operations that I get more and more requests to connect it to other platforms or get data out in some custom way. Aria Operations will continue to play a big role in the Aria suite, notably connecting to Aria Hub. People recognise its unique abilities, but sometimes need to integrate it in other corporate systems. It’s not about replacing it. In the last few months I had requests for OTRS, WorkDay, Grafana…

All about APIs….

So let’s look at some ways to interact with Operations. In this first part I will look at an easy, but often overlooked way: Powershell. In fact all techniques to get into (and out of) Aria Operations rely on the very mature API interface. You can test it in a Swagger interface if you go to the appropriate url in your instance: https://<fqdn of ops>/suite-api. This is a great tool to test things! There are number of articles about it, so I will not elaborate here.

Aria Operations API Swagger interface.

Using Powershell

The beauty is that VMware has written some modules for Powershell that hide these API calls and make it easy to write commands or scripts. Let’s show you! I suppose you have Powershell running somewhere. I am using v7.3 on my Mac. You can run it on Windows, Linux or even run the Docker image. Powershell basics is beyond the scope of this article.

To install all VMware modules, run this command in a Powershell window:

Install-Module -Name VMware.PowerCLI

This will install all commandlets in your environment. Note that you need internet access for this. Now we need to connect to the Aria Operations instance. There are different ways to do this, but for this test I use a local user. I also use -F to force connection on my lab server since I use a local certificate:

Connect-OMServer -F -Server '<vrops fqdn>' -User 'admin' -Password '<password>'

You will now hopefully get a message indicating a successful connection, namely the user connected. Now we can use all kinds of commands. For example ‘Get-OMAlert‘ to get all alerts.

Result of Get-OMAlert commandlet.

And even without scripting we can do some great stuff on the command line! To get all resources (objects) that contain ‘centos7’ in my environment, I run: Get-OMResource | grep 'centos7'. And I get:

centos7                      Green   VirtualMachine  
boredtest on centos7         Green   httpresponse    
Linux OS on centos7          Green   linux           

Now I want to see what stats (metrics) about CPU are gathered for my virtual machine ‘CentOS7’. I can achieve this by running: Get-OMStatKey -name cpu* -resource centos7

I get a nice table with all the stats. And now comes the beauty of it all! Let’s say I want to see the average CPU demand over the past month on this VM. Well the command line will be:
Get-OMStat -resource centos7 -key 'cpu|demandPct' -From ([DateTime]::Now).AddDays(-30) -IntervalType "Days" -IntervalCount 1 -RollupType "Avg"

The options are the name of the resource, statkey (metric name) and then -From to get the date interval. Note how we get the previous month here with some Powershell goodness… IntervalType is Days and intervalCount is 1. So I get one value per day for the last month… And that value is a rollup of type Average!

Result of the Get-OMStat commandlet.

Now we can also store this in a variable with a simple variable name and assignment like $demandcpu = … And now we see that Powershell knows objects and arrays by default! When I type in $demandcpu.Value I get only the 30 values. And $demandcpu.Value[0] will show: 4,22713874777158. The first value!

I can use these values here or write to a file or potentially pass on to an API call for another software system… I hope you see some possibilities! Let me know your remarks or questions.

If you need help, the Powershell way is to use the extensive help system. Type help Get-OMStat to see a complete overview of that command.

Result of help for Get-OMStat.

Reference:


Leave a Reply

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