, ,

NSX | How to get IPSec VPN Tunnel Statistics for all NSX edges

I simply recalled the NSX API through powershell and got the required result.

#Start
clear
#replace 1.1.1.1 with actual IP address of NSX Manager
Connect-NSXServer -NSXServer 1.1.1.1

#Put all the edge-IDs in below location, for which you want to see the result.
$edgeids = Get-Content -path C:\Temp\gjohar.txt

 foreach($edgeid in $edgeids){
 
   $EdgeApi =  Invoke-NSXRestMethod -method "GET" -uri "/api/4.0/edges/$edgeid/ipsec/statistics"
   $EdgeApi.ipsecStatusAndStats.InnerText

   }
#End
 

I haven't taken output in a file. I just ran the command, copied entire data and pasted in notepad++ to review. But if you want, you can do so.


Below is the sample output.

Note that : output for each edge's data is separated with help of "out-string". One liner output is for those edges which don't have any VPN configured.
 


Feel free to comment in case of any query\doubt. We are quite reactive.



Thank you,
Team vCLoudNotes

0 Comments:

Post a Comment