This script use the PowervRNI PowerShell module to get ingress and egress bandwidth statistics for an NSX-T Tier-1 Gateway (on-premises, or VMConAWS). The output of the script can be useful to calculate egress traffic charges for public clouds (e.g.,in a VMware Cloud on AWS context) by Tier-1 Gateways.
Starting vRealize Network Insight (vRNI) 3.6, the platform has a public API. PowervRNI is a PowerShell module that takes advantage of those public APIs and provides you with the option to look at vRNI data using PowerShell.
Note: this script is provided as an example.
The following steps assumes that vRealize Network Insight (or vRealize Network Insight Cloud) is already deployed, configured, and collecting data from vCenter and relevant NSX-T Manager.
The easiest way is to install PowervRNI is through the PowerShell Gallery where everything is taken care of for you.
PS C:\> Install-Module PowervRNI
PS C:\> Import-Module PowervRNI
The API of vRNI requires you to login to the Platform VM first. Here's how:
PS C:\> Connect-vRNIServer -Server superdope.vrni.lab -Username admin@local -Password VMware1!
- Adapt the list of NSX-T Edge Gateway (
$Tier1Gateways_to_lookup
, line 29) to your environment - Launch the script
- Enjoy
The period is currently 24 hours.
- Move the variable from static definition in the code to input
- Provide time frame choice (by 24 hours, monthly, etc.)