Skip to content

Commit

Permalink
Fix bad SNMP interface formatter
Browse files Browse the repository at this point in the history
Fixes #3659
  • Loading branch information
emanuele-f committed Mar 27, 2020
1 parent 35c6c21 commit c5f2303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions scripts/callbacks/system/snmp_device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,13 @@ local function snmp_device_run_user_scripts(snmp_device)
-- For each interface of the current device...
for snmp_interface_index, snmp_interface in pairs(device_interfaces) do
local if_type = snmp_iftype(snmp_interface.type)
local do_call = true

if(script.skip_virtual_interfaces and
((if_type == "propVirtual") or (if_type == "softwareLoopback"))) then
do_call = false
goto continue
end

if(do_call and conf.enabled) then
if(conf.enabled) then
local iface_entity = alerts_api.snmpInterfaceEntity(device_ip, snmp_interface_index)

alerts_api.invokeScriptHook(script, confset_id, hook_fn, device_ip, snmp_interface_index, table.merge(snmp_interface, {
Expand All @@ -108,6 +107,8 @@ local function snmp_device_run_user_scripts(snmp_device)
now = now,
}))
end

::continue::
end
end

Expand Down
2 changes: 1 addition & 1 deletion scripts/lua/modules/alerts_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ end
function alerts_api.snmpInterfaceEntity(snmp_device, snmp_interface)
return {
alert_entity = alert_consts.alert_entities.snmp_device,
alert_entity_val = string.format("%s_ifidx%d", snmp_device, snmp_interface)
alert_entity_val = string.format("%s_ifidx%s", snmp_device, ""..snmp_interface)
}
end

Expand Down

0 comments on commit c5f2303

Please sign in to comment.