Add host activity duration alert

This commit is contained in:
emanuele-f 2017-03-27 18:46:58 +02:00
parent 02051bbdbd
commit a0a767abbc
3 changed files with 18 additions and 2 deletions

View file

@ -14,7 +14,7 @@ alerts_granularity = {
{ "day", "Daily", 86400 }
}
alarmable_metrics = {'bytes', 'dns', 'idle', 'packets', 'p2p', 'throughput', 'ingress', 'egress', 'inner'}
alarmable_metrics = {'bytes', 'dns', 'active', 'idle', 'packets', 'p2p', 'throughput', 'ingress', 'egress', 'inner'}
default_re_arm_minutes = 1
@ -44,6 +44,12 @@ function packets(old, new, interval)
end
end
function active(old, new, interval)
if(verbose) then print("active("..interval..")") end
local diff = new["duration"] - old["duration"]
return(diff)
end
function idle(old, new, interval)
if(verbose) then print("idle("..interval..")") end
local diff = os.time()-new["seen.last"]
@ -1264,9 +1270,15 @@ function drawAlertSourceSettings(alert_source, delete_button_msg, delete_confirm
local num_engaged_alerts, num_past_alerts, num_flow_alerts = 0,0,0
local tab = _GET["tab"]
local descr = alert_functions_description
local descr
if alert_source:match("/") then
descr = network_alert_functions_description
elseif not alert_source:match("%.") then
-- interface
descr = table.clone(alert_functions_description)
descr["active"] = nil
else
descr = alert_functions_description
end
print('<ul class="nav nav-tabs">')