Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get current IPsec vpn numbers #94

Closed
eshaq786 opened this issue Mar 26, 2020 · 3 comments · Fixed by #166
Closed

Get current IPsec vpn numbers #94

eshaq786 opened this issue Mar 26, 2020 · 3 comments · Fixed by #166
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@eshaq786
Copy link

Is there a way to pull the number of current dial up IPSec VPN users using this powershell module?

@alagoutte alagoutte added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Mar 26, 2020
@alagoutte
Copy link
Contributor

Hi,

There is actually no cmdlet for monitoring info but you can try

PS > (Invoke-FGTRestMethod api/v2/monitor/vpn/ipsec).results

but not sure if there is all info (i can't try, i don't have dial up IPsec VPN)

FYI for VPN SSL, there is info :

PS > (Invoke-FGTRestMethod api/v2/monitor/vpn/ssl/stats).results

conserve_mode max                                   current
------------- ---                                   -------
        False @{users=4; tunnels=4; connections=17} @{users=3; tunnels=3; connections=3}

 PS >  (Invoke-FGTRestMethod api/v2/monitor/vpn/ssl).results

index                : 0
user_name            : alagoutte
remote_host          : 192.2.0.1
last_login_time      : Thu Mar 26 16:31:10 2020
last_login_timestamp : 1585236670
subsessions          : {@{index=1; parent_index=0; mode=Tunnel; type=Unknown; aip=10.200.250.1; in_bytes=121297;
                       out_bytes=176457; desthost=}}
subsession_type      : Unknown
subsession_desc      : aip:10.200.250.1

index                : 1
user_name            : user1
remote_host          : 192.2.0.2
last_login_time      : Thu Mar 26 18:33:30 2020
last_login_timestamp : 1585244010
subsessions          : {@{index=2; parent_index=1; mode=Tunnel; type=Unknown; aip=10.200.250.2; in_bytes=264932;
                       out_bytes=162526; desthost=}}
subsession_type      : Unknown
subsession_desc      : aip:10.200.250.2

index                : 2
user_name            : user3
remote_host          : 192.2.0.3
last_login_time      : Thu Mar 26 19:34:58 2020
last_login_timestamp : 1585247698
subsessions          : {@{index=3; parent_index=2; mode=Tunnel; type=Unknown; aip=10.200.250.3; in_bytes=42305;
                       out_bytes=88058; desthost=}}
subsession_type      : Unknown
subsession_desc      : aip:10.200.250.3

@Cool34000
Copy link
Contributor

Hi,

You can use this:
(Invoke-FGTRestMethod -uri api/v2/monitor/vpn/ipsec/select | select -ExpandProperty results | Where-Object { $_.parent -eq "DialUpVPN_Name" }).count

Simply change the name of your VPN DialUp!

@Cool34000
Copy link
Contributor

Also, If you want stats, you can remove the ".count" at the end of the command:

Invoke-FGTRestMethod -uri api/v2/monitor/vpn/ipsec/select | select -ExpandProperty results | Where-Object { $_.parent -eq "AgencesXXX" }

proxyid          : {@{proxy_src=System.Object[]; proxy_dst=System.Object[]; status=up; p2name=AgencesXXX; p2serial=6; expire=22098; incoming_bytes=6700940; outgoing_bytes=8528150}}
name             : AgencesXXX_0
parent           : AgencesXXX
comments         :
wizard-type      : custom
connection_count : 37
creation_time    : 2853730
type             : dialup
incoming_bytes   : 100365986
outgoing_bytes   : 190013198
rgwy             : x.x.x.x
dialup_index     : 0

proxyid          : {@{proxy_src=System.Object[]; proxy_dst=System.Object[]; status=up; p2name=AgencesXXX; p2serial=1; expire=19267; incoming_bytes=147396; outgoing_bytes=175500}}
name             : AgencesXXX_1
parent           : AgencesXXX
comments         :
wizard-type      : custom
connection_count : 20
creation_time    : 1707688
type             : dialup
incoming_bytes   : 95245694
outgoing_bytes   : 492716106
rgwy             : x.x.x.x
dialup_index     : 5

proxyid          : {@{proxy_src=System.Object[]; proxy_dst=System.Object[]; status=up; p2name=AgencesXXX; p2serial=1; expire=22146; incoming_bytes=9059632; outgoing_bytes=28578140}}
name             : AgencesXXX_2
parent           : AgencesXXX
comments         :
wizard-type      : custom
connection_count : 6
creation_time    : 450039
type             : dialup
incoming_bytes   : 107147958
outgoing_bytes   : 492447404
rgwy             : x.x.x.x
dialup_index     : 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants