Implements ZMQ flow collection drops alerts

This commit is contained in:
Simone Mainardi 2019-01-23 19:42:18 +01:00
parent 07eaeb2bcd
commit d21e8d6f3e
7 changed files with 76 additions and 0 deletions

View file

@ -2511,6 +2511,35 @@ function check_mac_ip_association_alerts()
end
end
-- Global function
function check_zmq_flow_collection_drops_alerts()
while(true) do
local message = ntop.lpopCache("ntopng.alert_zmq_flow_collection_drops")
local elems
if((message == nil) or (message == "")) then
break
end
elems = json.decode(message)
if elems ~= nil then
local entity = alertEntity("interface")
local entity_value = "iface_"..elems.ifid
local alert_type = alertType("zmq_flow_collection_drops")
local alert_severity = alertSeverity("error")
-- tprint(elems)
-- io.write(elems.ip.." ==> "..message.."[".. elems.ifname .."]\n")
interface.select(elems.ifname)
interface.storeAlert(entity, entity_value, alert_type, alert_severity,
i18n("alert_messages.zmq_flow_collection_drops",
{name = elems.ifname, drops = elems.delta_flow_collection_drops,
url = ntop.getHttpPrefix().."/lua/if_stats.lua?ifid="..elems.ifid}))
end
end
end
-- Global function
function check_nfq_flushed_queue_alerts()