Hi,
Via the vRealize Ops API I’m able to retrieve the same metrics like CPU|Demand (%) as StatKeys like via the vRealize Operations Manager web user interface. I’m using vRealize Ops 6.7.
Via the web UI it is possible to request time series about properties like Summary|Parent Host. However I’m unable to retrieve this via the API. Via /suite-api/api/resources/properties?resourceId= I can get the current Parent Host of a particular virtual machine however adding time range doesn’t work.
In the documentation /suite-api/docs/rest/index.html#queryLatestPropertiesOfResources the sample response shows the statKey system|availability but when I try this or use summary|parentHost I get a HTTP 403 return code.
How does the UI retrieve these metrics? Or does the UI convert these event series to time series?
Hi
Will advice you to check Postman Client Collection for vRealize Operations REST APIs - Samples - VMware {code}
you will find every thing over there , love Postman 🙂
Thanks,
Eran
sure that this youtube will help you on this topic : vRealize Operations Manager API Introduction w/ John Dias (@johnddias) - YouTube
Thanks,
Eran
It's actually not part of the big examples list.
You can achieve this using the "Internal API(s)" section of vrops, which doc is under /suite-api/docs/rest/internal_index.html
Since it's internal, I expect the syntax may change from one version to the other (if it is not just simply dropped :smileygrin: ).. on my version (VMware vRealize Operations Manager 7.0.0) the query will look like this:
$parentHost = (Invoke-RestMethod $url/internal/resources/properties/query `
-ContentType "application/json" `
-Method POST `
-Headers @{ accept = "application/json"; Authorization = "vRealizeOpsToken "+ $token.token ; "X-vRealizeOps-API-use-unsupported" = "true" } `
-Body (@{resourceId = @( $resourceId ) ; propertyKey = @("summary|parentHost") } | ConvertTo-Json) `
).values."property-contents"."property-content"
note that you need an extra header. Also the body contains the singular "resourceId" and "propertyKey" that are, in fact, lists.
The result is not a time serie, but seems to give you samples of the value at different times. This is how I battled with powershell to parse me the output:
0..($parentHost.timestamps.count-1) | foreach { ([datetime]'1/1/1970').AddMilliSeconds($parentHost.timestamps[$_]).ToString() + " " + $parentHost.values[$_] }
Voila hopefully it will be useful to someone.