Straight-Up Flying with the vRealize Operations REST API

by bluemedora_editor on February 26, 2016

Coming from a background in software development, I get excited when I see the words REST API documentation attached to a platform where the normal interface is graphical.

For many users, the highly-configurable web platform that is the face of vRealize Operations Manager is enough. But the REST API opens vROps to programmatic modification, custom parallel UI and meta-monitoring. For my money, if a GUI is walking, an open API might as well be flying. This post will introduce you to the vROps REST API with an example script in Ruby, but any tool you like for making REST calls will do. While you won’t quite be flying by the end of this post, you will take your first hops.

Blog1

Figure 1 — Getting started with the API

 

To get started with the API, you’ll direct your browser to https://vrops-host/suite-api (where ‘vrops-host’ is your own vROps instance). Here you’ll find the welcoming marquee found in Figure 1. Scrolling down from there, notice the libraries offered for accessing the API in Java, Python and Ruby. I’m ignoring those libraries in this post because handling plain old REST calls in Ruby is pretty trivial.

Blog2

Figure 2 — Digging into the API documentation

 

The REST call we’re starting with is in Figure 2: getAdapterInstance. The documentation suggests appending /api/adapters/{adapterId} to our base URL (https://vrops-host/suite-api); however, we’re not going to specify an adapterId. This way, we’ll get back all the adapter instances on this vROps instance. If UNIX shell scripting is your thing, you could take the cURL-ified example below and stop reading now.

curl https://vrops-host/suite-api/api/adapters -u ‘username:password’ -H ‘Content-Type: application/json’ -H ‘Accept: application/json’ –insecure

But hang on, the response is a ton of JSON! That’s where the parsing in my example Ruby script comes in.

Blog3

Figure 3 — REST in Ruby

 

The Ruby method in Figure 3 is a direct translation of the cURL command above. But the script doesn’t stop at the REST call; from there it parses all the adapter types, instances and hostnames on the vROps instance and prints them out pretty. Figure 4 shows a number of Blue Medora adapters configured on vROps. Let’s say we wanted to get a list of our monitored databases. We could simply filter down toMySQLAdapter, DB2_ADAPTER, POSTGRESQL_ADAPTER and SqlServerAdapter.

Blog4

Figure 4 — Some of the adapter instances on my vROps instance

 

The example in this post just scratches the surface on the superpowers that are available in the vROps REST API. You can also poll monitored resources and metrics, add adapter instances — just about anything else that you can do manually in vROps and a lot more. For now, dig into the example script on GitHub, or visit Blue Medora for more information on vROps management packs for databases and beyond.

 

This blog post was originally posted on VMware Cloud Management Blog. Read the full post here.

Get started

Try BindPlane for free. No credit card required.

Sign up
True Visibility
BindPlane for VMware vRealize Operations

True Visibility allows cloud management teams to use VMware vRealize’s powerful machine learning and capacity planning engine across their entire hybrid cloud environment.

Azure Monitor...everything
BindPlane for Microsoft Azure Monitor

Make Azure Monitor your first-pane-of-glass across your entire multi-cloud, multi-database or hybrid platform environment.

Thank you for contacting us. Your information was received. We'll be in touch shortly.