From 5c66bbb6195d2fa8c5efc9d68905cad1b19761d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 26 Dec 2019 12:16:38 +0100 Subject: [PATCH] [vpn stats] added number of configured/active VPNs --- vpn-statistics.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vpn-statistics.sh b/vpn-statistics.sh index a1e7960..c721cf9 100755 --- a/vpn-statistics.sh +++ b/vpn-statistics.sh @@ -9,3 +9,10 @@ done # countries with counter ( for ip in $(wg | grep endpoint | sed -e 's/endpoint: //' -e 's/\(.*\):[0-9]*/\1/' -e 's/\[//' -e 's/\]//'); do curl -s ipinfo.io/$ip | grep -e country ; done ) | sort | uniq -c | sort -g + +# Get number of configured VPNs +configured_vpns=$(wg show | grep ^peer | wc -l) +active_vpns=$(wg show | grep endpoint | wc -l) + +echo "Configured VPNs: ${configured_vpns}" +echo "Active VPNs: ${active_vpns}"