VPN Guardian Script— Telegram Alerts When Your VPN Goes Up or Down

Hey GL.iNet community!

I’m pretty new to scripting, but as a fun hobby project, I put together a lightweight bash script that monitor VPN tunnel (WireGuard/OpenVPN) on your router.

It sends you a Telegram message only when your VPN connection status changes — no annoying spam, just real alerts when something’s up or down.

I’m sharing it here in case anyone else finds it useful or wants to improve it. You can check it out on GitHub:

Would love to hear your feedback or tips! Stay safe and secure! Thanks!
:smile_cat:

P.S Also I already made a script ready for 4.8.0 that monitors both tunnels wireguard or openvpn and does the same job. Its working also good at me, I post it later :slight_smile:

1 Like

mine easy and simple. Ping any site using wireguard/vpn interface. If return timeout wg/vpn is down.

ping -c 1 -W 5 -I $WG_INTERFACE $TARGET > /dev/null

1 Like