wireguard-zabbix
is a Zabbix template to monitor Wireguard peers on Linux. It automatically discovers all your Wireguard peers and collects incoming/outgoing traffic usage.
This template assumes you have installed Wireguard with wireguard-install.sh
script (see this repo). It should work with vanilla Wireguard, but I didn't test it.
The instructions below are valid for Debian/Ubuntu but the principle should be applicable for other Linuxes as well.
- Add user zabbix to sudoers by adding the file
zabbix
to/etc/sudoers.d
with the following line:zabbix ALL=(root) NOPASSWD: /usr/bin/wg
- Add access rights to user
zabbix
for/etc/wireguard/wg0.conf
:setfacl -m 'u:zabbix:--x' /etc/wireguard setfacl -m 'u:zabbix:r--' /etc/wireguard/wg0.conf
- Add UserParameter to zabbix by adding the file
user_parameters.conf
to/etc/zabbix/zabbix_agentd.d
:UserParameter=wireguard.peers,/usr/share/zabbix/wg-json-zbx
- Copy script
wg-json-zbx
(based on wg-json) from this repo to/usr/share/zabbix
, make sure it's readable by the userzabbix
- Restart the agent:
service zabbix-agent restart
- Import the template