top of page
  • Brock Peterson

VMware Aria Operations: Add Windows VM Service Monitors via API

Today I'm monitoring a handful of Services on a Windows VM, I'd like to monitor these same Services across hundreds of Windows VMs. Adding each of the Service Monitors via the Aria Operations UI will be painful, there is no clone option or the ability to deploy Service Monitors to Custom Groups. Insert API here!

As you can see here, we're monitoring four Services. To add another you click the three dots next to Services then Add. I definitely don't want to do this on hundreds of servers, so let's explore the API (available at https://vrops_target_here/suite-api). You'll need a script to loop through your VMs and the calls, but here they are. First let's find a Windows VM with the Telegraf Agent installed.

To find our VM, run a GET /api/resources:

Optionally, you can tell it to look just for VMs with the ResourceKind option:

Once executed, it'll look like this:

The Curl to use in your script will be something like this:

curl -X GET "https://vr83-bpeterson.tvs.vmware.com/suite-api/api/resources?page=0&pageSize=1000&resourceKind=VirtualMachine&_no_links=true" -H  "accept: application/json" -H  "Authorization: vRealizeOpsToken 287ed085-c6ca-4255-b69c-956f1665ed51::7896253a-ceeb-45c3-ae6f-229c3ef6aa78"

Search the Response body for the VM you want:

To find the identifier for the VM, scroll down:

Back to our VM and the Services we're monitoring today.

Let's add a Service Monitor on our Windows VM for the Print Spooler service via POST /api/applications/agents/{id}/services:

The Curl looks like this:

curl -X POST "https://vr83-bpeterson.tvs.vmware.com/suite-api/api/applications/agents/570bd965-5b23-4506-9dc8-2974f1457cb5/services?_no_links=true" -H  "accept: application/json" -H  "Authorization: vRealizeOpsToken 287ed085-c6ca-4255-b69c-956f1665ed51::d06a22c2-7804-41dd-af25-0822fc6093ef" -H  "Content-Type: application/json" -d "{  \"services\" : [ {    \"serviceName\" : \"serviceavailability\",    \"configurations\" : [ {      \"configName\" : \"Print Spooler\",      \"isActivated\" : true,      \"parameters\": [        {          \"key\": \"FILTER_VALUE\",          \"value\": \"Spooler\"         }                    ]                       } ]                 } ]}"

And we're now monitoring the Print Spooler service on our Windows VM!

To scale, loop through your Windows VMs and run this API call for each Service monitor you'd like to add. Telegraf Agents are of course a requirement, good luck!



Comments


bottom of page