vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 89 forks source link

Need Script to display the NSX IP sec VPN Status and Statistics #353

Closed vTechworld closed 7 years ago

vTechworld commented 7 years ago

HI All,

Need help in getting the NSX IP sec Statistics using script.
ip sec vpn statitics

I am able to get the status up to VPN using this command but not able to get the IPsec VPN Statistics as per the attached screen shot.
$nsxvpnedge = Get-NsxEdge | where {$_.Name -match ("vpn")} $nsxvpnedge.features.ipsec.sites.site

Please help me in getting this.

Thank you Nandeesh M

alagoutte commented 7 years ago

Hi, it is because you need to get Ipsec Statistics and it is a another API call and it is not available for the moment...

vTechworld commented 7 years ago

Hi, Thank you very much for update.

Could you please let me know where I need to add this command. Or if you have script Please share me (Get-NsxEdge edge01 | Get-NsxIPsecStats).siteStatistics.tunnelStats

alagoutte commented 7 years ago

You need to wait this PR #354 will be merged (or you can try to use My https://github.com/alagoutte/powernsx/tree/Add-Get-NsxIPsecStats )

vTechworld commented 7 years ago

Hi,

I am able to get the Get-NsxIPsecStats command. But the problem what I faced here the command is not giving any result.

(Get-NsxEdge "edge-51" | Get-NsxIPsecStats).siteStatistics.ikeStatus

This is the command I executed and there is not result. image

Could you please help me on this.

Thank you,

vTechworld commented 7 years ago

Hi Alexis La Goutte,

I am able to get the output of the scripts. the problem what I done is instated of checking each IPsec I was checking multiple edge due that is not able to show the result.

I changed it to single VPN IPsec and able to get the result of both ikestatus and tunnelstatus

Thank you very much for helping me the get the result.

Thank you Thank you. :+1: :+1: :+1: :100:

vTechworld commented 7 years ago

Happy to work on POWERNSX

alagoutte commented 7 years ago

Need to merge the code now :-) (need to finish my test..)

waliapulkit commented 6 years ago

You need to wait this PR #354 will be merged (or you can try to use My https://github.com/alagoutte/powernsx/tree/Add-Get-NsxIPsecStats )

I need some help to install your branch of PowerNSX which contains Get-NsxIPsecStats. Could you please provide the steps to install this and run? I have been trying to run your branch but it isn't working. The cmdlet shows that:

image

alagoutte commented 6 years ago

Hi @waliapulkit Do you have re import the module? (and -force for reload)

waliapulkit commented 6 years ago

Hi @waliapulkit Do you have re import the module? (and -force for reload)

Hi @alagoutte , I tried re import module with -force as well, still it doesn't seem to be working. Looks like my enviroment is mixed up with vmware branch and your branch, I will clean up everything once.

I will appreciate if you can provide a step by step documentation process to access and use your branch.

Thanks.

alagoutte commented 6 years ago

@waliapulkit the better is will be my patch merged directly...

for use my patch you need to clone my repo, go on the branch

git checkout Add-Get-NsxIPsecStats

and manually import module :

import-module ./module/PowerNSX.psm1
waliapulkit commented 6 years ago

@alagoutte

Thanks, I will try this.

I was trying this instead:

$Branch="Add-Get-NsxIPsecStats";$url="https://raw.githubusercontent.com/alagoutte/powernsx/$Branch/PowerNSXInstaller.ps1"; try { $wc = new-object Net.WebClient;$scr = try { $wc.DownloadString($url)} catch { if ( $.exception.innerexception -match "(407)") { $wc.proxy.credentials = Get-Credential -Message "Proxy Authentication Required"; $wc.DownloadString($url) } else { throw $ }}; $scr | iex } catch { throw $_ }

alagoutte commented 6 years ago

and working ?

the other solution should @nmbradford @dcoghlan merge the patch :-)

joharG commented 5 years ago

I could do that with below blog.

https://vcloudnotes.blogspot.com/2019/10/how-to-get-ipsec-vpn-tunnel-stats-for.html

alagoutte commented 5 years ago

My patch is now merged... (but there is no yet new release of PowerNSX...)

joharG commented 5 years ago

hopefully you found it useful.