Closed birdie1 closed 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
Thanks :)
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