Skip to content

Commit c5f2303

Browse files
author
emanuele-f
committed
Fix bad SNMP interface formatter
Fixes #3659
1 parent 35c6c21 commit c5f2303

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

scripts/callbacks/system/snmp_device.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,13 @@ local function snmp_device_run_user_scripts(snmp_device)
9090
-- For each interface of the current device...
9191
for snmp_interface_index, snmp_interface in pairs(device_interfaces) do
9292
local if_type = snmp_iftype(snmp_interface.type)
93-
local do_call = true
9493

9594
if(script.skip_virtual_interfaces and
9695
((if_type == "propVirtual") or (if_type == "softwareLoopback"))) then
97-
do_call = false
96+
goto continue
9897
end
9998

100-
if(do_call and conf.enabled) then
99+
if(conf.enabled) then
101100
local iface_entity = alerts_api.snmpInterfaceEntity(device_ip, snmp_interface_index)
102101

103102
alerts_api.invokeScriptHook(script, confset_id, hook_fn, device_ip, snmp_interface_index, table.merge(snmp_interface, {
@@ -108,6 +107,8 @@ local function snmp_device_run_user_scripts(snmp_device)
108107
now = now,
109108
}))
110109
end
110+
111+
::continue::
111112
end
112113
end
113114

scripts/lua/modules/alerts_api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ end
426426
function alerts_api.snmpInterfaceEntity(snmp_device, snmp_interface)
427427
return {
428428
alert_entity = alert_consts.alert_entities.snmp_device,
429-
alert_entity_val = string.format("%s_ifidx%d", snmp_device, snmp_interface)
429+
alert_entity_val = string.format("%s_ifidx%s", snmp_device, ""..snmp_interface)
430430
}
431431
end
432432

0 commit comments

Comments
 (0)