mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Implements stateful alerts in C and sqlite
This commit is contained in:
parent
781b3d4988
commit
12f24a87b4
11 changed files with 425 additions and 214 deletions
|
|
@ -287,6 +287,13 @@ alert_type_keys = {
|
|||
{ "<i class='fa fa-exclamation'></i> Suspicious Activity", 10, "suspicious_activity" },
|
||||
}
|
||||
|
||||
alert_entity_keys = {
|
||||
{ "Interface", 0, "interface" },
|
||||
{ "Host", 1, "host" },
|
||||
{ "Network", 2, "network" },
|
||||
{ "SNMP device", 3, "snmp_device" }
|
||||
}
|
||||
|
||||
function alertSeverityLabel(v)
|
||||
return(_handleArray(alert_level_keys, tonumber(v)))
|
||||
end
|
||||
|
|
@ -311,6 +318,18 @@ function alertType(v)
|
|||
return(_handleArray(typetable, v))
|
||||
end
|
||||
|
||||
function alertEntityLabel(v)
|
||||
return(_handleArray(alert_entity_keys, tonumber(v)))
|
||||
end
|
||||
|
||||
function alertEntity(v)
|
||||
local typetable = {}
|
||||
for i, t in ipairs(alert_entity_keys) do
|
||||
typetable[#typetable + 1] = {t[2], t[3]}
|
||||
end
|
||||
return(_handleArray(typetable, v))
|
||||
end
|
||||
|
||||
function firstToUpper(str)
|
||||
str = tostring(str)
|
||||
return (str:gsub("^%l", string.upper))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue