OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: nothing on March 20, 2020, 06:21:32 am

Title: Extract OpenVPN server status
Post by: nothing on March 20, 2020, 06:21:32 am
Hi guys,
Is there a way to get the status of OpenVPN server with all the clients connected?
API doesn't seem to provide such capability. If I try to socat it from the unix socket (/var/etc/openvpn/server1.sock) it breaks the server and reboot is required. SNMP maybe?
Title: Re: Extract OpenVPN server status
Post by: bartjsmit on March 20, 2020, 01:53:27 pm
Add a status line to your OpenVPN server config file. Details on the man page: https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage

Bart...
Title: Re: Extract OpenVPN server status
Post by: nothing on March 21, 2020, 06:14:23 am
Thanks for the idea! Worked!
Now feeding Graphite with data like this:
Code: [Select]
echo "OpenVPN.clients_count `cat /tmp/openvpn-status.txt | grep CLIENT_LIST | /usr/bin/wc -l` `date +%s`" | /usr/bin/nc -N 192.168.1.100 2003