mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 15:08:40 +01:00
zabbix: use ubus for zabbix-extra-network
this allow us to stop using uci /var/state, which is deprecated since forever Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
@@ -3,7 +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 uci -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("network", "interface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#NET}\":\""..s[".name"].."\"}," 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.."\", \"{#NET}\":\""..intf.interface.."\"},";end;list=string.gsub(list,",$","");print(list.."]}")'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"user": "zabbix",
|
||||
"access": {
|
||||
"network.interface": {
|
||||
"methods": [ "dump" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user