A shell script to grab statistic of OpenVPN connections
-
Place script wherever in accessible directory for Zabbix user(i.e. '/etc/zabbix/scripts') on the remote OpenVPN server with working zabbix agent
-
Configure paths for variables (if necessary) (by default script ueses default directory for openvpn logs)
-
Grant access for Zabbix user to openvpn logfile
-
Grant access for Zabbix user to script directory and script itself
chown root:zabbix /etc/zabbix/scripts
chmod 550 -R /etc/zabbix/scripts
-
Add UserParameter in zabbix_agent.conf (you can place it as well after "UnsafeUserParameters")
UserParameter=openvpn[*],/etc/zabbix/scripts/openvpn_statistic.sh $1
-
Restart the Zabbix agent (according to your installation)
systemctl restart zabbix-agent
-
Import template-openvpn-statistic.xml
-
Enjoy!