cryptage21 / wireguard-zabbix

Template to monitor WireGuard with Zabbix
27 stars 7 forks source link

Fix for IPv6 detection on key wg.endpoint.address #2

Closed birdie1 closed 4 years ago

birdie1 commented 4 years ago

The previous code splitted the ipaddress at the first colon. As IPv6 addresses contains many colons, it should be splitted at the last colon. The new code also removes the quare brackets from ipv6 address. It detects now IPv4 and IPv6 correctly.

Before: root@test:/var/lib/zabbix# zabbix_get -s 192.168.170.2 -p 10050 -k wg.endpoint.address[iwufh87ffr] [2a01

After: root@test:/var/lib/zabbix# zabbix_get -s 192.168.170.2 -p 10050 -k wg.endpoint.address[iwufh87ffr] 2a01:4f9:2b:1630:beef:1:0:7a64

cryptage21 commented 4 years ago

Thanks :)