blob: 37bc43a93604db54b4f2eebc67d62e039aaf7936 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
widget = {
plugin = 'network-linux',
cb = function(t)
local r = {}
for iface, params in pairs(t) do
local addr = params.ipv4
if addr then
-- strip out "label" from the interface name
iface = iface:gsub(':.*', '')
-- strip out "zone index" from the address
addr = addr:gsub('%%.*', '')
if iface ~= 'lo' then
r[#r + 1] = string.format('[%s: %s]', iface, addr)
end
end
end
return r
end,
}
|