So this next post is for a script which generates reports and saves me countless hours each time I use it…

If you have ever tried to get metrics out of the vRops suite-api using STATS… you know the output is less than optimal. The data is exported in either XML, JSON or CSV…. but the data structure requires some post processing for use in excel. The time stamps are in epoch time and are separated by a space, the values are all within the same node and also separated by spaces (see examples below)

I am collecting all the data using powershell via the suite-api, the xls is generated thanks to the great module ImportExcel by dfinke.

The output XLS contains Data, DataPivotTable, Config and Alarms sheets, here is the example XLS used for the screenshots below.

pivot-00

Use the resourceName and METRIC to filter on the objects and metrics required, the example below I have 2 VM’s: WINSRV2 and WINSRV4 and selected the cpu|readyPct metric. I use this to compare the performance of VM’s running on different hosts or clusters which perform the same task.. this allows me to easily look for differences and anomalies between servers.

pivot-01

The config sheet provides a list of resourceName, resourceKindKey, ParentvCenter, ParentCluster, ParentHost, PowerState, Memory, CPU, CPUcores, INFO this shows the configuration of the VM’s, the cluster and hosts they are currently running.

pivot-02

The alarm sheet provides a list for the object’s queried which includes name, startTime, updateTimealertLevel, suspendUntilTime, cancelTime, alertId, alertDefinitionName, status, controlState for a long as the Alarm retention in vRops not only for the report duration…

pivot-03

So to the script..

So that I don’t keep being prompted for credentials I save the service account user and password with the powershell Get-Credential command.

The script can be run by specifying all parameters otherwise it will use some default values.

-vRopsAddress : IP or DNS name of vRops environment to pull data from.

-Creds : HOME is the name of the XML file to pull the credentials from IE: HOME.xml

-CollectionType : Collection (this will be used to switch between different types of collections in the future).

-ResourceByName : is an array of objects (datastores, hosts, VM’s etc…) use the name of the object as it appears in vRops / vCenter.

-Metrics : is an array of specific metrics to collect from vRops for the object(s)

vRops has 100’s of metrics of each object and they can be instance specific so the best way to collect a list is to run a daily collection for 1 day without specifing -Metric and filtering the results in Excel. (Example below)

-Interval and -rollUpTypes must be specified together.
intervalType=HOURS (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)
intervalType=MINUTES (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)
intervalType=SECONDS
intervalType=DAYS (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)
intervalType=WEEKS (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)
intervalType=MONTHS (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)
intervalType=YEARS (rollUpType=SUM,AVG,MIN,MAX,LATEST,COUNT)

Run with -Metric, -startdate and -enddate

Run without -startdate & -enddate will default to the last 24H

Run without -Metrics and it will pull all metrics

 

 

 

 

If you appreciated the script, please check out and click on a few of the sponsored Ad’s to help with my hosting.

Here is the full script with the folder structure: DumpvRopsMetric