What's new

VPNMON VPNMON-R3 v1.3.7 -Oct 20, 2024- Monitor WAN/Dual-WAN/OpenVPN Health & Reset Multiple OpenVPN Connections (Now available in AMTM!)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Alright, then I have some artistic critique on what can be outputted :)

Code:
  VPNMON-R3 - v1.3.5                  (S)how/(H)ide Operations Menu               Mon Sep 30 08:25:40 CDT 2024

  Slot | Mon |  Svrs  | Health | VPN State    | Public VPN IP   | Ping-->VPN | City Exit / Time
-------|-----|--------|--------|--------------|-----------------|------------|---------------------------------
  VPN1 | [X] | [0004] | [ OK ] | Connected    | 108.181.092.050 | [0012.538] | Dallas: 0d 00h:42m
  VPN2 | [X] | [0007] | [ OK ] | Connected    | 037.120.157.250 | [0034.783] | Miami: 0d 00h:07m
  VPN3 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a]      | [n/a]
  VPN4 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a]      | [n/a]
  VPN5 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a]      | [n/a]
-------|-----|--------|--------|--------------|-----------------|------------|---------------------------------

  6s / 10% [e=Exit] [Selection?  ]

Svrs - will one really ever go up to 9999 servers in the list? Seems like 99 would be enough, or at least 999? So minus 1 or 2 characters
Health - looks good
"VPN State" - too wide, call it "Link", and say ON or OFF ? YES or NO ? ...
"Public VPN IP" - looks good
"Ping" - would be OK to just do 3 or 4 digits, no decimals.
"City Exit / Time" - split into "Time" (goes first since it's fixed width), then City Exit (goes last)

Extra credit - some additional useful statistics to consider, say you are going to track the last 20 (N) pings:
percent of successful pings out of last N or less if just started
average successful ping in ms
standard deviation of the successful pings

For this one has a couple of arrays of N length, keep success [0 or 1], and ping value. Then as the values reach the end, start overwriting. Keep track of sum of x, and sum of x^2, so you can calculate standard deviation. So when overwriting you remove the oldest x from the sum of x, and x^2, and add the new one. If reconnecting - clear everything.
 
Alright, then I have some artistic critique on what can be outputted :)
Everyone is always a critic it seems...

Svrs - will one really ever go up to 9999 servers in the list? Seems like 99 would be enough, or at least 999? So minus 1 or 2 characters
I have 2171 servers for one of my slots. Thinking I'm going to stick with 4 chars.

"VPN State" - too wide, call it "Link", and say ON or OFF ? YES or NO ? ...
VPN state is either connected or disconnected... or error. Not liking the suggestions.

"Ping" - would be OK to just do 3 or 4 digits, no decimals.
Some people like to see this down to the 1000's for their ping times... some people are even very vocal about this. I like being extremely accurate as much as possible when displaying this info.

"City Exit / Time" - split into "Time" (goes first since it's fixed width), then City Exit (goes last)
The days could be 1 digit, 2 digits, even 3 digits in extreme cases.... so it's a variable field, along with the city name... perfect keeping them together.

Extra credit - some additional useful statistics to consider, say you are going to track the last 20 (N) pings:
percent of successful pings out of last N or less if just started
average successful ping in ms
standard deviation of the successful pings

For this one has a couple of arrays of N length, keep success [0 or 1], and ping value. Then as the values reach the end, start overwriting. Keep track of sum of x, and sum of x^2, so you can calculate standard deviation. So when overwriting you remove the oldest x from the sum of x, and x^2, and add the new one. If reconnecting - clear everything.
I'm probably not going to do to well on this test... good suggestions though. But I'm pretty happy with the way it looks/works at the moment. I'll consider adding more stats down the road... maybe even on it's own stats page.
 
Everyone is always a critic it seems...

...

I'm probably not going to do to well on this test... good suggestions though. But I'm pretty happy with the way it looks/works at the moment. I'll consider adding more stats down the road... maybe even on it's own stats page.
Sorry, I got too excited with the new useful addition to my router! :D

It solved an important issue for me, so I thought I'd feedback some fresh eye perspective.

Of course, it does all I need already - so happy how it is! Thanks again for developing in!
 
@Viktor Jaep,

One of my relatives has been using VPNMON-R3 for about 3 months now, and he said it's been working well for his home network needs. However, last Friday evening, he wanted to review & modify a few configuration settings and ran into some issues that can be recreated consistently every time. Since he's aware that you're currently on a "leave of absence" to get some certification for work, he didn't want to bother you so he asked me if I could take a quick look, in case he was doing something wrong.

After recreating the problems he found, I reviewed the script code and made several fixes & improvements. Note that the issues are not critical; they're all on the "Configuration Menu" and were caused by incorrect handling of some user input, which would lead to unintended or wrong settings, but those settings can be corrected if the user notices the modified values upon returning to the main configuration menu.

Here's the breakdown of the issues he found.

1) After selecting menu option 2 ("Custom PING host to determine VPN health"), if the user simply pressed the <Enter> key *without* entering any new value, the currently selected value was set to empty/NULL regardless of the current setting.

VPNMON-R3_PingHostRemoved.jpg



2) The following 4 menu options had the same issue. If the user simply pressed the <Enter> key *without* entering any new value, the "[: 0: unknown operand" error message was generated and the currently selected value got reset regardless of the current setting.

a) Select menu option "(3) : Custom Event Log size (rows)"​

VPNMON-R3_LogSizeReset.jpg



b) Select menu option "(5) : Refresh Custom Server Lists on -RESET Switch"​

VPNMON-R3_RefreshServerListReset.jpg



c) Select menu option "(6) : Provide additional WAN/Dual WAN monitoring"​

VPNMON-R3_WANMonitoringReset.jpg



d) Select menu option "(7) : Whitelist VPN Server IP Lists in Skynet"​

VPNMON-R3_WhiteListServerIPListReset.jpg



In addition, I found the following 2 issues while doing testing & verification:

3) After selecting menu option 1 ("Number of VPN Client Slots available"), if the user simply pressed the <Enter> key *without* entering any new value, the currently selected value got reset to "1 2 3 4 5" regardless of the current setting.

[See 1st image in the next post - hit max limit for # of attached files]​

4) When selecting menu option 2 ("Custom PING host to determine VPN health"), any user input was accepted for the host IP address because there was no IPv4 address format validation.

[See 2nd image in the next post - hit max limit for # of attached files]​

I'll be submitting a pull request with all the fixes to your GitHub repo shortly.
 
[Part #2 from previous post]

Selecting menu option 1 ("Number of VPN Client Slots available") & pressing <Enter> key.

VPNMON-R3_NumberOfClientSlotsReset.jpg



Selecting menu option 2 ("Custom PING host to determine VPN health"), there was no IPv4 address format validation.

VPNMON-R3_PingHostInvalid.jpg



I also made the following improvements:

1) Added user input check & validation for the cron job hours & minutes.

Before fix:​
VPNMON-R3_NoCronHourMinsValidation.jpg


After fix:​

VPNMON-R3_CronJobHourMinsValidationOK.jpg


2) Adjusted formatting of the number of servers to avoid left-padding with zeros while still maintaining table alignment.

3) Adjusted formatting of ping values to avoid left-padding with zeros while still maintaining table alignment.

VPNMON-R3_NonPaddedValues.jpg


The numbers are much easier to read at a quick glance, IMO.

UPDATE:
The PR #14 has been submitted to the GitHub repo (develop branch).

If anyone would like to give the modified version a try before @Viktor Jaep has a chance to issue a Beta release, here are the commands to download it:
Bash:
curl -LSs --retry 3 --retry-delay 5 --retry-connrefused \
https://raw.githubusercontent.com/Martinski4GitHub/VPNMON-R3/refs/heads/develop/vpnmon-r3.sh \
-o /jffs/scripts/vpnmon-r3.sh && chmod 755 /jffs/scripts/vpnmon-r3.sh
 
Last edited:
UPDATE:
The PR #14 has been submitted to the GitHub repo (develop branch).

If anyone would like to give the modified version a try before @Viktor Jaep has a chance to issue a Beta release, here are the commands to download it:
Thanks so much for adding these fixes and correcting the logic, @Martinski! I'll get this added to the official beta track here soon! You are amazing... thanks for all your hard work on this. And you're right... I do like it better without the left-padded zeroes! ;)
 
Like it. Just a shame about the leading zeros in the IPs being a fixed feature for padding.
 
Like it. Just a shame about the leading zeros in the IPs being a fixed feature for padding.
That can be modified as well to something that's much easier to read. I thought about making the change but I was not sure which format to use and then I simply ran out of time.

There are at least 2 formats that could be used for display purposes while still keeping table alignment:

Display Format #1
Rich (BB code):
-----------------
        1.2.3.4
    12.34.56.78
123.123.123.123
-----------------

Display Format #2
Rich (BB code):
------------------
  1.  2.  3.  4
 12. 34. 56. 78
123.123.123.123
-----------------

Which one would be the preferred display format?
My personal preference is the 1st format.
I'll add new code to the existing PR, and I'll let Viktor decide.

UPDATE:
New non-padded IP address display formats have been included in the PR #14.

Format #1:

VPNMON-R3_NonPaddedIPaddress#1.jpg


Format #2:

VPNMON-R3_NonPaddedIPaddress#2.jpg


Viktor can decide which format to go with for the next release.
 
Last edited:
That can be modified as well to something that's much easier to read. I thought about making the change but I was not sure which format to use and then I simply ran out of time.

There are at least 2 formats that could be used for display purposes while still keeping table alignment:

Display Format #1
Rich (BB code):
-----------------
        1.2.3.4
    12.34.56.78
123.123.123.123
-----------------

Display Format #2
Rich (BB code):
------------------
  1.  2.  3.  4
 12. 34. 56. 78
123.123.123.123
-----------------

Which one would be the preferred display format?
My personal preference is the 1st format.
I'll add new code to the existing PR, and I'll let Viktor decide.

UPDATE:
New non-padded IP address display formats have been included in the PR #14.

Format #1:

View attachment 61870

Format #2:

View attachment 61871

Viktor can decide which format to go with for the next release.
I do like the 1st format as well 😉 Thanks @Martinski!
 
HUGE thanks to @Martinski for all his hard work fixing all my bugs in VPNMON-R3! I really appreciate having a professional like him polishing it up a bit... and also many thanks for bringing some change in eliminating zeros from various counters and IP addresses while keeping the tables looking aligned! Thanks to everyone out there for all your patience during my leave of absence... I wanted to get a couple of these script changes out the door and released in the interim as they have been patiently waiting... ;)

What's new?
v1.3.6 - (October 12, 2024)
- PATCH:
After selecting menu option 1 ("Number of VPN Client Slots available"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was reset to "1 2 3 4 5" regardless of the current setting.
- PATCH: After selecting menu option 2 ("Custom PING host to determine VPN health"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was set to empty/NULL regardless of the current setting.
- PATCH: When selecting menu option 2 ("Custom PING host to determine VPN health"), any user input was accepted for the IP address because there was no IPv4 address format validation.
- PATCH: After selecting menu option 3 ("Custom Event Log size (rows)"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was reset to "2000" regardless of the current setting. In addition, the error message "[: 0: unknown operand" was generated.
- PATCH: After selecting menu option 5 ("Refresh Custom Server Lists on -RESET Switch"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was reset to "Enabled" regardless of the current setting. In addition, the error message "[: 0: unknown operand" was generated.
- PATCH: After selecting menu option 6 ("Provide additional WAN/Dual WAN monitoring"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was reset to "Enabled" regardless of the current setting. In addition, the error message "[: 0: unknown operand" was generated.
- PATCH: After selecting menu option 7 ("Whitelist VPN Server IP Lists in Skynet"), if the user simply pressed the <Enter> key without entering any new value, the currently selected value was reset to "Disabled" regardless of the current setting. In addition, the error message "[: 0: unknown operand" was generated.
- PATCH: Added user input validation for Cron Job hours & minutes
- PATCH: Adjusted display format of the number of servers to avoid left-padding with zeros while still maintaining table alignment.
- PATCH: Adjusted display format of ping values to avoid left-padding with zeros while still maintaining table alignment.
- PATCH: Adjusted display format of IPv4 addresses to avoid left-padding with zeros while still maintaining table alignment.
- PATCH: Various other coding improvements & fine-tuning.

Download link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R3/main/vpnmon-r3.sh" -o "/jffs/scripts/vpnmon-r3.sh" && chmod 755 "/jffs/scripts/vpnmon-r3.sh"

Significant screenshots:
1728766929511.png
 
Last edited:
Just FYI, after upgrading to v1.3.6 the display was 'goofy' until I let it refresh for 1 cycle. No info about my domains and neither (S)how nor (H)ide did anything and it only displayed the top 2 lines (i.e. the 'VPNMON-R3 - v 1.3.6 ...' line)
I rebooted the router and the behaviour was the same until I let it sit for a couple of minutes.

Now it seems to be working as designed.

Edit: spelling and to add I'm using a AX68 with the latest merlin version, 388.8.2
 
Just FYI, after upgrading to v1.3.6 the display was 'goofy' until I let it refresh for 1 cycles. No info about my domains and neither (S)how nor (H)ide did anything and it only displayed the top 2 lines (i.e. the 'VPNMON-R3 - v 1.3.6 ...' line)
I rebooted the router and the behaviour was the same until I let it sit for a couple of minutes.

Now it seems to be working as designed.
I see the same with RTRMON — it takes a second refresh before displayed data is accurate.
 
Confirmed - I see exactly the same. No sweat though, it's rare I even visit the CLI these days 😁
 
Just for completeness, this is what it looks like even when using the reset option (R):
...
Based on your screenshot, it seems like the script is getting "stuck" somewhere within the main loop while gathering the data to display on the screen.

Can you post the contents of your configuration file?
Bash:
/jffs/addons/vpnmon-r3.d/vpnmon-r3.cfg

Also, try running the script with a debug flag next time when the issue occurs:
Bash:
sh -x /jffs/scripts/vpnmon-r3.sh -noswitch

When/if the script gets "stuck" just press "<Ctrl-C>" to terminate & exit, and then post the results. They might provide some clues as to where and why.

Just my 2 cents.
 
Based on your screenshot, it seems like the script is getting "stuck" somewhere within the main loop while gathering the data to display on the screen.

Can you post the contents of your configuration file?
Bash:
/jffs/addons/vpnmon-r3.d/vpnmon-r3.cfg

Also, try running the script with a debug flag next time when the issue occurs:
Bash:
sh -x /jffs/scripts/vpnmon-r3.sh -noswitch

When/if the script gets "stuck" just press "<Ctrl-C>" to terminate & exit, and then post the results. They might provide some clues as to where and why.

Just my 2 cents.
Again, what it takes is waiting for 2 full cycles and then everything works as normal, as I indicated in my posts :)
 
Also, try running the script with a debug flag next time when the issue occurs:
Bash:
sh -x /jffs/scripts/vpnmon-r3.sh -noswitch
I've tried a few dozen times. VPNMON runs absolutely fine with that switch. I've tried everything, including restarting entware apps and rebooting the router. The run with the switch will be fine a few times in a row, then if I run VPNMON from AMTM the delay shows it's head.
It's not every time, it's like 2-3 times out of 10 reboots.
 
Again, what it takes is waiting for 2 full cycles and then everything works as normal, as I indicated in my posts :)
Really weird. Works for me immediately on start. I'm starting it from command line...not AMTM.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top