So with this next post I wanted to help explain / break down how to use the suite-api to extract stats, alarms and properties. I already provide a script which does the stats extract (stats on steroids) but I thought some of you might be interested to understand how it works.
Lets start off simple…
Where to find the API and Documentation? —-> https://yourvRopsServer/suite-api
Now you want to extract metrics from vRops, you first need to determine what the ResourceKindKey is and which metrics are available for that object
Where to find the ResourceKindKeys —-> https://yourvRopsServer/suite-api/api/adapterkinds
How to lookup objects in vRops by name and obtain the resourceID (identifier) —-> https://yourvRopsServer/suite-api/api/resources?resourceKind=$resourceKindKey&name=$vRopsObjName
Make sure you specify the type of object you are looking up by using resourceKind=, this is very important if you have multiple resources with the same name (VirtualMachines, End Point Operations, etc… )
As you can see in the 1st example the call only returned one result for the VirtualMachine, but in the 2nd it returned three one for the Virtual Machine and two others related the End Point Operations agent.
So by this point you are all like… this is nice and dandy… but GET TO THE METRIC EXTRACTION PART!!
Which metrics can I extract for the desired resourceKind? —-> https://yourvRopsServer/suite-api/api/adapterkinds/VMWARE/resourcekinds/VirtualMachine/statkeys
The following API call will list all the metrics for the VirtualMachine resourceKind for the adapterkind VMWARE
Below is an example of 2 of the 100’s of metrics for the VirtualMachine resourceKind.
alright.. now we know how to search for the object and which stat keys exist… lets put it together to pull out data!
Using the desired metric keys and the resourceId extracted in the previous example we can construct the call to extract metrics between date/time X and Y… we just need to specify some additional parameters!
intervalType: Interval type requested by the user (e.g: Days, Weeks, Months etc.)
rollUpType: Rollup Type requested by the user (e.g.: AVG, MIN, MAX etc.)
begin: start date in epoc time (milliseconds)
end: end date in epoc time (milliseconds)
The example below will extract several statkeys for a single server.
If you want to do this for multiple servers just add additional resourceId’s to the URL
cool so now we know how to extract stats… lets get to the
Extracting all the Alerts from a Resource is just a simple API call —–> https://yourvRopsServer/suite-api/api/alerts?resourceId=ResourceID
See simple!! what about all the properties you ask?!?!?
Extracting all the Properties from a Resource is just another simple API call —-> https://yourvRopsServer/suite-api/api/resources/ResourceID/properties
Hopefully you found this helpful.