Basic filtering | https://zvm_ip:port/ZvmService/ResourcesReport/getSamples?fromTimeString={fromTimeString}&toTimeString={toTimeString}&startIndex={startIndex}&count={count} |
Advanced filtering | https://zvm_ip:port/ZvmService/ResourcesReport/getSamplesWithFilter?fromTimeString={fromTimeString}&toTimeString={toTimeString}&startIndex={startIndex}&count={count}&filter={filter} |
zvm_ip | The IP address of the Zerto Virtual Manager where the API is run. | |
port | The port to access the Zerto Virtual Manager. The default port is 9669. | |
getSamples | Basic filtering is used. | |
getSamplesWithFilter | Advanced filtering is used. |
startIndex | The first record within the time frame to write to the report. The value is zero-based and the default starting point is the first record, startIndex=0. |
fromTimeString | The starting time of the report, supplied as a date and time with the format of the Zerto Virtual Manager where the API runs, with the format yyyy-mm-dd hh:mm:ss. If the time portion is not specified, the starting time of the report is 00:00:00. |
toTimeString | The end time of the report, supplied as a date and time with the format of the Zerto Virtual Manager where the API runs, with the format yyyy-mm-dd hh:mm:ss. If the time portion is not specified, the starting time for the report is 00:00:00. |
count | The number of records to write to the report. The maximum value is 500 and values over 500 default to 500. If a value is not specified, no records are written in the report. To return more than 500 records, see Perl Code Example: Retrieving All the Records. |
filter | Enables advanced filtering of the results according to specific criteria. For example: filter=(SourceSite='Las Vegas') The filter can include =, >, >=, <, <=, <>, the “or” and the “and” logical operators. For example: (SourceSite='New York' or SourceSite='London') and (ThroughputInBytes>5.6 or ThroughputInBytes<2.6 or ThroughputInBytes=3) and (NumberOfvCpu>=2) Passing an empty filter is equivalent to not specifying any advanced filtering. filter= | |
Filter | Description | |
ActiveGuestMemoryInMB | The active memory of the virtual machine. | |
BandwidthInBytes | The average bandwidth used between two consecutive samples. | |
ConsumedHostMemoryInMB | The amount of host memory consumed by the virtual machine. | |
CpuLimitInMhz | The maximum MHz available for the CPUs in the virtual machine. | |
CpuReservedInMhz | The MHz reserved for use by the CPUs in the virtual machine. | |
CpuUsedInMhz | The MHz used by the CPUs in the virtual machine. | |
CrmId | The CRM identifier specified in Zerto Cloud Manager for an organization that uses a cloud service provider for recovery. | |
MemoryInMB | The virtual machine defined memory. | |
MemoryLimitInMB | The upper limit for this virtual machine’s memory allocation. | |
MemoryReservedInMB | The guaranteed memory allocation for this virtual machine. | |
NumberOfvCpu | The number of CPUs for the virtual machine. | |
NumberOfVolumes | The number of volumes attached to the virtual machine. | |
RecoveryJournalProvisionedStorageInGB | The amount of provisioned journal storage for the virtual machine. | |
RecoveryJournalUsedStorageInGB | The amount of used journal storage for the virtual machine. | |
RecoveryVolumesProvisionedStorageInGB | The amount of provisioned storage for the virtual machine in the target site. This value is the sum of volumes’ provisioned size. | |
RecoveryVolumesUsedStorageInGB | The amount of used storage for the virtual machine in the target site. | |
ServiceProfile | The service profile used by the VPG. | |
SourceCluster | The source cluster name hosting the virtual machine. | |
SourceHost | The source ESX/ESXi name hosting the virtual machine. | |
SourceOrgVDC | The name of the source vDC Org. | |
SourceResourcePool | The source resource pool name hosting the virtual machine. | |
SourceSite | The source protected site name, defined in the Zerto User Interface. | |
SourceVCDOrg | The name of the source vCD Org. | |
SourceVolumesProvisionedStorageInGB | The amount of provisioned storage for the virtual machine in the source site. This value is the sum of volumes’ provisioned size. | |
SourceVolumesUsedStorageInGB | The amount of used storage for the virtual machine in the source site. This value is the sum of the volumes’ used size. | |
SourceVraName | The name of the source VRA used to send data to the recovery site. | |
StorageProfile | The target vCD storage profile used. | |
TargetCluster | The target cluster name hosting the virtual machine. | |
TargetDatastores | The target datastore used for the virtual machine if it is recovered. | |
TargetHost | The target ESX/ESXi name hosting the virtual machine when it is recovered. | |
TargetOrgVDC | The name of the target vDC Org | |
TargetResourcePool | The target resource pool name where the virtual machine will be recovered. | |
TargetSite | The target site name, defined in the Zerto User Interface. | |
TargetVCDOrg | The name of the target vCD Org. | |
TargetVraName | The name of the recovery VRA managing the recovery. | |
ThroughputInBytes | The average throughput used between two consecutive samples. | |
Timestamp | The date and time the resource information was collected. | |
VmHardwareVersion | The VMware hardware version. | |
VmId | The internal virtual machine identifier. The identifier comprises the server identifier and the virtual machine moref, with the format, serverid.moref. | |
VmName | The name of the virtual machine. | |
VpgName | The name of the VPG. | |
VpgType | The VPG Type: VC2VC – vCenter to vCenter replication. VC2VCD – vCenter to vCloud Director replication. VCD2VCD – vCloud Director to vCloud Director replication. VCD2VC – vCloud Director to vCenter replication. | |
ZORG | An organization set up in the Zerto Cloud Manager using a cloud service provider for recovery. |
<ArrayOfVmResourcesInfoStorageObject xmlns="http://schemas.datacontract.org/2004/07/Zerto.Zvm.Storage.StorageObject" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <VmResourcesInfoStorageObject> <ActiveGuestMemoryInMB>20</ActiveGuestMemoryInMB> <BandwidthInBytes>-1</BandwidthInBytes> <ConsumedHostMemoryInMB>153</ConsumedHostMemoryInMB> <CpuLimitInMhz>-1</CpuLimitInMhz> <CpuReservedInMhz>0</CpuReservedInMhz> <CpuUsedInMhz>89</CpuUsedInMhz> <CrmId/> |
<MemoryInMB>2048</MemoryInMB> <MemoryLimitInMB>-1</MemoryLimitInMB> <MemoryReservedInMB>0</MemoryReservedInMB> <NumberOfVolumes>1</NumberOfVolumes> <NumberOfvCpu>1</NumberOfvCpu> |
<RecoveryJournalProvisionedStorageInGB>16</RecoveryJournalProvisionedStorageInGB> <RecoveryJournalUsedStorageInGB>0.584</RecoveryJournalUsedStorageInGB> <RecoveryVolumesProvisionedStorageInGB>5</RecoveryVolumesProvisionedStorageInGB> <RecoveryVolumesUsedStorageInGB>1.106</RecoveryVolumesUsedStorageInGB> |
<ServiceProfile>System Service Profile</ServiceProfile> <SourceCluster/> <SourceHost>987.65.432.1</SourceHost> <SourceOrgVDC/> <SourceResourcePool/> <SourceSite>Dallas</SourceSite> <SourceVCDOrg/> <SourceVolumesProvisionedStorageInGB>5</SourceVolumesProvisionedStorageInGB> <SourceVolumesUsedStorageInGB>1.106</SourceVolumesUsedStorageInGB> <SourceVraName>Z-VRA-987.65.432.1</SourceVraName> <StorageProfile/> |
<TargetCluster>London Cluster</TargetCluster> <TargetDatastores>datastore2</TargetDatastores> <TargetHost>123.45.678.9</TargetHost> <TargetOrgVDC/> <TargetResourcePool/> <TargetSite>London</TargetSite> <TargetVCDOrg/> <TargetVraName>Z-VRA-123.45.678.9</TargetVraName> <ThroughputInBytes>-1</ThroughputInBytes> <Timestamp>2014-02-04T01:00:23</Timestamp> |
<VmHardwareVersion>vmx-07</VmHardwareVersion> <VmId xmlns:a="http://schemas.datacontract.org/2004/07/Zerto.Zvm.Common.VirtualizationManager.VCenter"> <a:InternalVmName>vm-518</a:InternalVmName> <a:ServerIdentifier> <a:ServerGuid>cbaab5ca-3915-4df7-8223-1ac851021f5a</a:ServerGuid> </a:ServerIdentifier> </VmId> <VmName>Billing</VmName> <VpgName>New VPG</VpgName> <VpgType>VC2VC</VpgType> <Zorg/> </VmResourcesInfoStorageObject> |
<VmResourcesInfoStorageObject> ... </VmResourcesInfoStorageObject> ... </ArrayOfVmResourcesInfoStorageObject> |
Parameter | Description |
ActiveGuestMemoryInMB | The active memory of the virtual machine. |
BandwidthInBytes | The average bandwidth used between two consecutive samples. |
ConsumedHostMemoryInMB | The amount of host memory consumed by the virtual machine. |
CpuLimitInMhz | The maximum MHz available for the CPUs in the virtual machine. |
CpuReservedInMhz | The MHz reserved for use by the CPUs in the virtual machine. |
CpuUsedInMhz | The MHz used by the CPUs in the virtual machine. |
CrmId | The CRM identifier specified in Zerto Cloud Manager for an organization that uses a cloud service provider for recovery. |
MemoryInMB | The virtual machine defined memory. |
MemoryLimitInMB | The upper limit for this virtual machine’s memory allocation. |
MemoryReservedInMB | The guaranteed memory allocation for this virtual machine. |
NumberOfvCpus | The number of CPUs for the virtual machine. |
NumberOfVolumes | The number of volumes attached to the virtual machine. |
RecoveryJournalProvisionedStorageInGB | The amount of provisioned journal storage for the virtual machine. |
RecoveryJournalUsedStorageInGB | The amount of used journal storage for the virtual machine. |
RecoveryVolumesProvisionedStorageInGB | The amount of provisioned storage for the virtual machine in the target site. This value is the sum of volumes’ provisioned size. |
RecoveryVolumesUsedStorageInGB | The amount of used storage for the virtual machine in the target site. |
ServiceProfile | The service profile used by the VPG. |
SourceCluster | The source cluster name hosting the virtual machine. |
SourceHost | The source ESX/ESXi name hosting the virtual machine. |
SourceOrgVDC | The name of the source vDC Org. |
SourceResourcePool | The source resource pool name hosting the virtual machine. |
SourceSite | The source protected site name, defined in the Zerto User Interface. |
SourceVCDOrg | The name of the source vCD Org. |
SourceVolumesProvisionedStorageInGB | The amount of provisioned storage for the virtual machine in the source site. This value is the sum of volumes’ provisioned size. |
SourceVolumesUsedStorageInGB | The amount of used storage for the virtual machine in the source site. This value is the sum of the volumes’ used size. |
SourceVraName | The name of the source VRA used to send data to the recovery site. |
StorageProfile | The target vCD storage profile used. |
TargetCluster | The target cluster name hosting the virtual machine. |
TargetDatastores | The target datastore used for the virtual machine if it is recovered. |
TargetHost | The target ESX/ESXi name hosting the virtual machine when it is recovered. |
TargetOrgVDC | The name of the target vDC Org |
TargetResourcePool | The target resource pool name where the virtual machine will be recovered. |
TargetSite | The target site name, defined in the Zerto User Interface. |
TargetVCDOrg | The name of the target vCD Org. |
TargetVraName | The name of the recovery VRA managing the recovery. |
ThroughputInBytes | The average throughput used between two consecutive samples. |
Timestamp | The date and time the resource information was collected. The value can be converted to an understandable date using code similar to the following: var date = new Date(jsonDate); or code similar to the Perl code example, jsonDateToString($), in Perl Code Example: Retrieving the First 100 Records |
VmHardwareVersion | The VMware hardware version. |
VmId | The internal virtual machine identifier. The identifier comprises the server identifier and the virtual machine moref, with the format, serverid.moref. |
VmName | The name of the virtual machine. |
VpgName | The name of the VPG. |
VpgType | The VPG Type. Possible values are: VC2VC – vCenter to vCenter replication. VC2VCD – vCenter to vCloud Director replication. VCD2VCD – vCloud Director to vCloud Director replication. VCD2VC – vCloud Director to vCenter replication. |
ZORG | An organization set up in the Zerto Cloud Manager using a cloud service provider for recovery. |
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use JSON; |
main(); sub main { my $url = "https://zvm_ip:port/ZvmService/ResourcesReport/getSamples?fromTimeString=2014-01-01&toTimeString=2015-01-01 23:59:59&startIndex=0&count=100"; print "Retrieving $url\n"; my $userAgent = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $url); $req->header(Accept => 'application/json'); my $res = $userAgent->request($req); |
if ($res->is_success) { my $json = new JSON; my @json_array = @{$json->decode($res->content)}; my $last_timestamp = ""; for my $elem (@json_array) { my $timestamp = jsonDateToString($elem->{Timestamp}); if ($timestamp ne $last_timestamp) { print "\nTime: $timestamp\n"; $last_timestamp = $timestamp; } print "VPG: $elem->{VpgName}, VM: $elem->{VmName}, Bandwidth (Bps): $elem->{BandwidthInBytes}\n"; } } else { print $res->status_line, "\n"; } } |
sub jsonDateToString($) { my $json_date = shift; if ($json_date =~ m{ \b (\d+) \b ([+-]\d\d\d\d\b)? }x ) { my ( $epoch_milliseconds, $time_zone ) = ( $1, $2 ); return localtime($epoch_milliseconds / 1000); } return $json_date; } |
Retrieving https://zvm_ip:port/ZvmService/ResourcesReport/getSamples?fromTimeString=2013-06-20&toTimeString=2013-06-22 23:59:59&startIndex=0&count=100 Time: Thu Jun 20 01:00:00 2013 VPG: HR Dallas, VM: HR Dallas, Bandwidth (Bps): 639.437 VPG: HR NY, VM: HR New York, Bandwidth (Bps): 206.335 VPG: HR London, VM: HR London, Bandwidth (Bps): 1261.204 VPG: Reporting, VM: NY Reporting, Bandwidth (Bps): 2998.503 VPG: BO Recs, VM: Reconciliation, Bandwidth (Bps): 7.988 VPG: FX Report, VM: FX, Bandwidth (Bps): 1397.885 Time: Fri Jun 21 01:00:00 2013 VPG: HR Dallas, VM: HR Dallas, Bandwidth (Bps): 833.524 VPG: HR NY, VM: HR New York, Bandwidth (Bps): 183.923 VPG: HR London, VM: HR London, Bandwidth (Bps): 1282.578 VPG: Reporting, VM: NY Reporting, Bandwidth (Bps): 4429.341 VPG: BO Recs, VM: Reconciliation, Bandwidth (Bps): 7.994 VPG: DC Zertolab.local, VM: DC Zertolab.local, Bandwidth (Bps): 872.078 Time: Sat Jun 22 01:00:00 2013 VPG: HR Dallas, VM: HR Dallas, Bandwidth (Bps): 870.926 VPG: HR NY, VM: HR New York, Bandwidth (Bps): 218.696 VPG: HR London, VM: HR London, Bandwidth (Bps): 1245.913 VPG: Reporting, VM: NY Reporting, Bandwidth (Bps): 3022.375 VPG: BO Recs, VM: Reconciliation, Bandwidth (Bps): 7.994 VPG: FX Report, VM: FX, Bandwidth (Bps): 942.535 |
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use JSON; |
main(); sub main { my $zvm = "1.2.3.4"; my $startIndex = 0; my $count = 500; my $url; my $last_timestamp = ""; my $json = new JSON; my $userAgent = LWP::UserAgent->new my $num_results_from_last_query = 0; do { $url = "https://$zvm:9669/ZvmService/ResourcesReport/getSamples?fromTimeString=2013-01-01&toTimeString=2015-01-01&startIndex=$startIndex&count=$count"; print "Retrieving $url\n"; my $req = HTTP::Request->new(GET => $url); $req->header(Accept => 'application/json'); my $res = $userAgent->request($req); if ($res->is_success) { my @json_array = @{$json->decode($res->content)} $num_results_from_last_query = @json_array; for my $elem (@json_array) { my $timestamp = jsonDateToString($elem->{Timestamp}); if ($timestamp ne $last_timestamp) { print "\nTime: $timestamp\n"; $last_timestamp = $timestamp; } print "VPG: $elem->{VpgName}, VM: $elem->{VmName}, Bandwidth (Bps): $elem->{BandwidthInBytes}\n"; } $startIndex += $count; } else { print "Error: ", $res->status_line, "\n"; last; } } while ($num_results_from_last_query == $count); } |
sub jsonDateToString($) { my $json_date = shift; if ($json_date =~ m{ \b (\d+) \b ([+-]\d\d\d\d\b)? }x ) { my ( $epoch_milliseconds, $time_zone ) = ( $1, $2 ); return localtime($epoch_milliseconds / 1000); } return $json_date; } |