Cloud Management Platform vRealize Operations

Straight-Up Flying with the vRealize Operations REST API

By: Mike Langdon, Blue Medora

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.

Figure 1_Flying with vROps REST API

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.

Figure 2_Flying with vROps REST API

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.

Figure 3_Flying with vROps REST API

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 to MySQLAdapter, DB2_ADAPTER, POSTGRESQL_ADAPTER and SqlServerAdapter.

Figure 4_Flying with vROps REST API

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.