Extract number of users connected to IPSsec/L2tpd server

ipsecl2tppoint-to-point-protocolzabbix

We have a new corporate VPN server running Ipsec (Openswan) + xl2tpd + pppd. When a user connects, pppd runs the /etc/ppp/auth-up script which logs the time and username that has connected to /var/log/pppstats. However, on our older OpenVPN system we were able to finger the OpenVPN daemon to query the number of currently connected users and this is a metric which our management require to be reported via our Zabbix monitoring servers.

It would seem relying on the log file to analyze the number of connected users to be extremely unreliable since if a user shuts down their machine without terminating the connection then we have an eternally connected user. Any ideas on how this metric could be extracted reliably as possible?

Best Answer

One option would be to check the output of netstat. Even something as simple as this should work (it would probably need updating for the exact service names:

netstat -ano | grep poptop | wc -l
Related Topic