Community discussions

 
telepro
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Sun Apr 03, 2011 7:50 pm

access to SSTP-Client Uptime

Wed Jul 25, 2018 8:43 pm

Is there a command line request that will return the uptime for an sstp-client (available on the winbox interface status page when the sstp VPN connection is operational). It shows the time that this particluar SSTP vpn connections has been operational.

Neither of these work:
:put [/interface sstp-client get [find interface=VPN-To-Host] uptime]
:put [/interface sstp-client get [find interface=VPN-To-Host] value-name=uptime]

Perhaps the uptime is available under another value-name?
Thanks in advance
 
User avatar
dasiu
Trainer
Trainer
Posts: 232
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: access to SSTP-Client Uptime

Wed Jul 25, 2018 9:11 pm

:put ([/interface sstp-client monitor VPN-To-Host once as-value]->"uptime")
 
telepro
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Sun Apr 03, 2011 7:50 pm

Re: access to SSTP-Client Uptime

Wed Jul 25, 2018 11:53 pm

Thank you very much. I don't believe I have seen this format described before.
So do i understand correctly:

/interface sstp-client monitor VPN-To-Host once creates and returns a text buffer Example:
;;; VPN Connection to LCD-RTR
status: connected
uptime: 39m52s
encoding: AES256-CBC
mtu: 1500
local-address: 10.221.0.80
remote-address: 10.221.0.1

adding the 'as-value' incorporates each row of text into an array of text strings in memory indexed by the headings (left of the ':')
and adding the ->"uptime" selects the row of the the array

Interesting to explore what all is available using that sequence.
Thanks again.
 
User avatar
dasiu
Trainer
Trainer
Posts: 232
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: access to SSTP-Client Uptime

Thu Jul 26, 2018 12:19 am

adding the 'as-value' incorporates each row of text into an array of text strings in memory indexed by the headings (left of the ':')
and adding the ->"uptime" selects the row of the the array
So:
1. Adding "as-value" presents the results of print (and also monitor) commands in the "array" form. To check - please try this:
:put [/interface sstp-client monitor VPN-To-Host once as-value];
2. The format with semicolons creates an array. You can do for example:
:local book {"title"="Hamlet";"author"="Shakespeare";"pages"="251"};
:put ($book->"author");
- that's how you get the single value from the array.
3. Usually you can get single values with "get" - but those are only the values you can also "print". Here the uptime is one of the parameters that change every second and "print" doesn't show them, only "monitor" - so to see it you need to do:
/interface sstp-client monitor VPN-To-Host
4. As the above command keeps refreshing every second - we use "once" to show it only once :).
/interface sstp-client monitor VPN-To-Host once
And then - making the array from it (with as-value) and getting the element with -> - now you know the full story :).

Who is online

Users browsing this forum: No registered users and 7 guests