zabbix: fix 6in4 network interface discovery
authorJacek Konieczny <jajcus@jajcus.net>
Fri, 19 Nov 2021 16:55:19 +0000 (17:55 +0100)
committerEtienne Champetier <champetier.etienne@gmail.com>
Sun, 21 Nov 2021 16:00:53 +0000 (11:00 -0500)
Those devices don't have 'device' propery, only 'l3_device', which
causes 'attempt to concatenate field 'device' (a nil value)' lua error.

Use 'l3_device' as a fallback in this case.

Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
admin/zabbix/Makefile
admin/zabbix/files/network

index 333a60977bc4a2983484f3ba710abe454922b3f6..0eeab81f320abb69022fde722f81d679bb69b438 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zabbix
 PKG_VERSION:=5.0.7
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://cdn.zabbix.com/zabbix/sources/stable/5.0/
index 43a0d3943d8715b0d474307031b91c02523a0c7e..96bf194fab7d5aa2c2a3b34efedd5d163de5befb 100644 (file)
@@ -3,4 +3,4 @@
 # network interface discovery
 # example: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]}
 #
-UserParameter=netowrt.discovery,lua -l ubus -e 'u=ubus.connect();list="{\"data\":[";dump=u:call("network.interface", "dump", {});for _, intf in ipairs(dump.interface) do list=list.."{\"{#IF}\":\""..intf.device.."\", \"{#NET}\":\""..intf.interface.."\"},";end;list=string.gsub(list,",$","");print(list.."]}")'
+UserParameter=netowrt.discovery,lua -l ubus -e 'u=ubus.connect();list="{\"data\":[";dump=u:call("network.interface", "dump", {});for _, intf in ipairs(dump.interface) do list=list.."{\"{#IF}\":\""..(intf.device or intf.l3_device).."\", \"{#NET}\":\""..intf.interface.."\"},";end;list=string.gsub(list,",$","");print(list.."]}")'