diff --git a/Tests/Public/Get-ZANetworkSiteStat1.ps1 b/Tests/Public/Get-ZANetworkSiteStat1.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZANetworkSiteStat1.ps1 @@ -0,0 +1,19 @@ +#Requires -Modules Pester +$moduleFileName = "ZertoApiWrapper.psd1" +$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") +$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") +$file = Get-ChildItem "$here\$sut" +$modulePath = $here -replace "Public", "" +$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" +Get-Module -Name ZertoApiWrapper | Remove-Module -Force +Import-Module $moduleFile -Force + +Describe $file.BaseName -Tag 'Unit' { + + It "is valid Powershell (Has no script errors)" { + $contents = Get-Content -Path $file -ErrorAction Stop + $errors = $null + $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) + $errors | Should -HaveCount 0 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 new file mode 100644 index 0000000..6762b4a --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 @@ -0,0 +1,47 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkSiteStat { + [CmdletBinding(DefaultParameterSetName = "ProtectedSite")] + param ( + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "ProtectedSite", + Mandatory + )] + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "RecoverySite" + )] + [ValidateNotNullOrEmpty()] + [string]$protectedSiteIdentifier, + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "RecoverySite", + Mandatory + )] + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "ProtectedSite" + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the executive summary." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/sites-network-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/docs/Get-ZANetworkSiteStat.md b/docs/Get-ZANetworkSiteStat.md new file mode 100644 index 0000000..8bb0167 --- /dev/null +++ b/docs/Get-ZANetworkSiteStat.md @@ -0,0 +1,167 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAMonitoring.md +schema: 2.0.0 +--- + +# Get-ZANetworkSiteStat + +## SYNOPSIS + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for sites, filtered by start date and end date. + +## SYNTAX + +### ProtectedSite (Default) +``` +Get-ZANetworkSiteStat -protectedSiteIdentifier [-recoverySiteIdentifier ] + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +### RecoverySite +``` +Get-ZANetworkSiteStat [-protectedSiteIdentifier ] -recoverySiteIdentifier + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for sites, filtered by start date and end date. The following options are available: + +* To view network stats of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier. +* To view network stats between two sites, specify both the protected site identifier and the recovery site identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkSiteStat -protectedSiteIdentifier "7890-1234-5678" +``` + +Returns all outgoing networks stats from site with identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZANetworkSiteStat -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns all networks stats between sites with identifiers "7890-1234-5678" and "9876-5432-1098" + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -protectedSiteIdentifier +Protected site identifier. +A site identification is required for at least one of the sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +Recovery site identifier. +If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the executive summary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network Site Summary](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_stats)