What's new

VPNMON VPNMON-R2 v2.0 -Jul 10, 2022- Monitor your VPN connection's Health (Thread locked/closed)

  • 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!

I seem to be too old for this or impatient to read the whole line. You are correct, I missed the & at the end of the line that I often use in my scripts. Time to retire ;)
If you were to retire from being thelonelycoder, what would you do? and, who would you be? I think those questions are much harder to answer than if you stayed the awesome way you are and threw out that retirement hat that does not quite yet fit the way you would like.
 
Good morning guys. I am using ExpressVPN and VPNFailover to keep track of it. Can I replace the VPNFailover with this addon ?? Do I get any benefits?
 
Good morning guys. I am using ExpressVPN and VPNFailover to keep track of it. Can I replace the VPNFailover with this addon ?? Do I get any benefits?
While I can't speak for VPNFailover since I haven't used it for quite a while, there are some similarities, but VPNMON-R2 certainly builds on it. You definitely have a few other parameters to play with, like randomization and scheduled resets, but also other reset factors like high ping load, or letting it automatically connect to the fastest server in your list. Plus, the interface was built to give you a lot of info on your current connection, exit cities, stats, etc. Feel free to give it a try... If you need any assistance, or have any good ideas that would make it even better, you can always drop a line here. ;)
 
Nope, nothing changed. That happens from time to time. I believe when the API gets hit too hard or gets overloaded, it just doesn't respond back with a city lookup, and vpnmon-r2 in that case will just default to the exit IP. It happens to me frequently when I do a lot of testing, where I'm hitting it on a very frequent basis.

Give it a few minutes, kill the script, and try it again... it will most likely work. ;)
It's back to normal this morning. Thank you for the follow-up.
 
I want to share one consolidated post regarding how I autostart VPNMON and DNSMON since there is a demand.

  1. Create file named
    Bash:
    #!/bin/sh
    ########################
    ## call-monitors.sh
    ########################
    
    LogCmd="/usr/bin/logger -sct "$0_$$""
    
    _DoExit_() {
      $LogCmd "EXIT $1"
      exit $1
    }
    
    $LogCmd "START"
    
    # Set Maximum Timeout value as you see fit #
    MaxTimeout=600
    SleepSecs=2
    TimerSecs=0
    
    OptBinFile="/opt/sbin/screen"
    
    if [ "$1" == "DNS" ]; then
      ScriptFile="sh /jffs/scripts/merlin-dns-monitor.sh"
      ScreenName="dnsmon"
    elif [ "$1" == "VPN" ]; then
      ScriptFile="sh /jffs/scripts/vpnmon-r2.sh -monitor"
      ScreenName="vpnmon-r2"
    else
      $LogCmd "ERROR: Incorrect argument passed. [$1]"
      _DoExit_ 2
    fi
    
    if [ ! -f $ScriptFile ]; then
      $LogCmd "ERROR: [$ScriptFile] NOT found."
      _DoExit_ 1
    fi
    
    until [ -f $OptBinFile ] || [ $TimerSecs -ge $MaxTimeout ]; do
      sleep $SleepSecs
      TimerSecs=$(($TimerSecs + $SleepSecs))
    done
    
    if [ ! -f $OptBinFile ]; then
      $LogCmd "ERROR: [$OptBinFile] NOT found."
      _DoExit_ 2
    fi
    
    $LogCmd "Launching $ScriptFile"
    $OptBinFile -dmS $ScreenName $ScriptFile
    
    _DoExit_ 0
    
    #EOF#
  2. Add the following at the end of
    Bash:
    if [ -x ${1}/entware/bin/opkg ] && [ -f /jffs/scripts/call-monitors.sh ]; then
      /jffs/scripts/call-monitors.sh DNS &
      /jffs/scripts/call-monitors.sh VPN &
    fi

If you don't use DNSMON, then you can comment out or delete the line that passes DNS as a variable in post-mount.
 
I want to share one consolidated post regarding how I autostart VPNMON and DNSMON since there is a demand.

  1. Create file named
    Bash:
    #!/bin/sh
    ########################
    ## call-monitors.sh
    ########################
    
    LogCmd="/usr/bin/logger -sct "$0_$$""
    
    _DoExit_() {
    $LogCmd "EXIT $1"
    exit $1
    }
    
    $LogCmd "START"
    
    # Set Maximum Timeout value as you see fit #
    MaxTimeout=600
    SleepSecs=2
    TimerSecs=0
    
    OptBinFile="/opt/sbin/screen"
    
    if [ "$1" == "DNS" ]; then
    ScriptFile="sh /jffs/scripts/merlin-dns-monitor.sh"
    ScreenName="dnsmon"
    elif [ "$1" == "VPN" ]; then
    ScriptFile="sh /jffs/scripts/vpnmon-r2.sh -monitor"
    ScreenName="vpnmon-r2"
    else
    $LogCmd "ERROR: Incorrect argument passed. [$1]"
    _DoExit_ 2
    fi
    
    if [ ! -f $ScriptFile ]; then
    $LogCmd "ERROR: [$ScriptFile] NOT found."
    _DoExit_ 1
    fi
    
    until [ -f $OptBinFile ] || [ $TimerSecs -ge $MaxTimeout ]; do
    sleep $SleepSecs
    TimerSecs=$(($TimerSecs + $SleepSecs))
    done
    
    if [ ! -f $OptBinFile ]; then
    $LogCmd "ERROR: [$OptBinFile] NOT found."
    _DoExit_ 2
    fi
    
    $LogCmd "Launching $ScriptFile"
    $OptBinFile -dmS $ScreenName $ScriptFile
    
    _DoExit_ 0
    
    #EOF#
  2. Add the following at the end of
    Bash:
    if [ -x ${1}/entware/bin/opkg ] && [ -f /jffs/scripts/call-monitors.sh ]; then
    /jffs/scripts/call-monitors.sh DNS &
    /jffs/scripts/call-monitors.sh VPN &
    fi

If you don't use DNSMON, then you can comment out or delete the line that passes DNS as a variable in post-mount.
NICE. That is one *beast* of an autostart! Love it!
 
NICE. That is one *beast* of an autostart! Love it!
I should probably update it to use CASE statements instead of IF. I think it would be cleaner.
 
Thanks for the new toy!

Just installed it and noticed a typo (extra word) in:

Would you like to (use) proceed through this setup using default values...

(sorry to be a pedant!)

edit: you might also want to take a look at the first line of step 5.
 
Thanks for the new toy!

Just installed it and noticed a typo (extra word) in:

Would you like to (use) proceed through this setup using default values...

(sorry to be a pedant!)

edit: you might also want to take a look at the first line of step 5.
Thank you very much @RimRider ... that will be corrected in the next release! I'm going to blame the cat on that one... she was staring me down at the time from behind my laptop... :p

thecatmademedoit.jpg


PS... got that wording issue in step 5 as well. Lol. Damn cat! :)
 
I've been waiting for this day... finally... a preconfigured NordVPN server slot decided to go offline in the middle of the day. The IP is no longer reachable. The next upcoming version of VPNMON-R2 will now be aware of this scenario and indicate this on screen as shown below... ;)

1657308604273.png
 
Just to clarify, this will also work with other commercial VPN providers such as TorGuard and ProtonVPN?
 
Just to clarify, this will also work with other commercial VPN providers such as TorGuard and ProtonVPN?
Absolutely! Just make sure you have pre-filled and preconfigured your VPN slots. And then let her loose!
 
Last edited:
With the demise of VPNON, a major release today that brings this functionality back to into VPNMON-R2! Enjoy!

v2.0 - (July 10, 2022)
* MAJOR:
The VPNON.SH project has been sunset. Instead of maintaining almost 2 identical functions in both VPNMON-R2 and VPNON, I have decided to terminate the VPNON project. All functionality of VPNON will continue to live on in VPNMON-R2.
* ADDED: The ability to reset the VPN with a "vpnmon-r2.sh -reset" commandline switch. This gives you the same functionality that VPNON gave you, and are able to use this method to randomly reset your VPN connection using CRON jobs. VPNMON-R2 running in its own SSH or Screen window will be aware of these actions, will pause the UI while the reset is running, and will resume when finished.
* ADDED: New indicator showing if one of your pre-configured VPN host slots goes down, and is no longer reachable via ping, and will display the affected VPN slot as OFFLINE.
1657457277778.png

* ADDED: Configured an alias for VPNMON-R2 which lets you call all functions relating to the script from any location (without having to be in the /jffs/scripts folder or having to call it like /jffs/scripts/vpnmon-r2.sh), now using a command like this: "vpnmon-r2 -log"
* FIXED: Made a few more wording changes in the setup menu thanks to the keen eye of @RimRider, and also tweaked the functionality of the menu a bit more. Now, when calling the setup menu from the UI, you will return to the UI when exiting out of the menu.
 
Ya know, I don't have a VPN. But I've been reading this thread consistently and the dialogue, functionality and back-and-forth between all of you have me (almost) wanting to subscribe to one - just so I can run VPNMON-R2. Nicely done all.
 
Ya know, I don't have a VPN. But I've been reading this thread consistently and the dialogue, functionality and back-and-forth between all of you have me (almost) wanting to subscribe to one - just so I can run VPNMON-R2. Nicely done all.
LOL... thanks @Wrkdbf_Guy! Really, it's super transparent, and adds another nice layer of privacy on our already privacy-trampled worlds. It's pretty affordable too, and decent options out there. I'm not here to endorse NordVPN, but they make it extremely easy to work with from an API standpoint... their mobile app is great too. SurfShark and Perfect Privacy are also very good at keeping up with modern times. There are lots of other VPN providers out there that are excellent, but from from an interfacing standpoint for scripts like this, they make things much more difficult if they don't offer an API. I definitely try to give my ISP a run for their money as my family and I pop out of 2000 random VPN servers all over the country on a continuous basis. :p
 
For everyone else (like @Wrkdbf_Guy above) who is on the fence when it comes to setting up your own awesome whole-home VPN, and don't know where to start... I've greatly enhanced the how-to guide to show how literally anyone can do this with minimal effort... If you're on this journey, and need any assistance, feel free to post below, and we'll get you on your way! :)

How-to-setup-a-VPN guide!
 
Hey @Viktor Jaep, I noticed something the other day when I choose to use the lightest load instead of the lowest ping for my reset. I still had a value for max ping, so my connection kept dropping but the lightest load had a ping higher than my configured value.

I hope that makes sense, but if not, here's an example:
I set my max acceptable ping to 150ms
Slot 1: Connected, ping is 175ms, load is 8%
Slot 2: Ping is 100ms, load is 10%
Slot 3: Ping is 65ms, load is 12%
Slot 4: Ping is 140ms, load is 9%

I ended up having three drops during Facetime until I changed the config back to choosing the lowest ping.

The connection will keep resetting and choosing the lightest load, but the ping is still above the threshold. Could you have the script exclude VPNs that are above the ping threshold when selecting the lightest load?
 
Hey @Viktor Jaep, I noticed something the other day when I choose to use the lightest load instead of the lowest ping for my reset. I still had a value for max ping, so my connection kept dropping but the lightest load had a ping higher than my configured value.

I hope that makes sense, but if not, here's an example:
I set my max acceptable ping to 150ms
Slot 1: Connected, ping is 175ms, load is 8%
Slot 2: Ping is 100ms, load is 10%
Slot 3: Ping is 65ms, load is 12%
Slot 4: Ping is 140ms, load is 9%

I ended up having three drops during Facetime until I changed the config back to choosing the lowest ping.

The connection will keep resetting and choosing the lightest load, but the ping is still above the threshold. Could you have the script exclude VPNs that are above the ping threshold when selecting the lightest load?
I don't really check for the "lightest load"... but there's a parameter that will reset your connection if it exceeds a certain load? What's your load parameter set to? Default = 50.

Also... when you were using the lowest ping method, how many chances were you giving it to recover being the lowest? Default = 5.

PS. would love to see your logs on this too if that's an option! :)
 
Yeah, I just updated to 2.0 and realized I wrote that incorrectly and couldn't fix it before you saw it. LOL

I meant random.

1657555041180.png


If I use random and have a lowest ping value, the random one is often the same one with a high ping.
 

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