mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-08 06:24:34 +00:00
extends get/alert/ts.lua to retrieve per-host counters
This commit is contained in:
parent
7224958bb9
commit
174cedcb95
2 changed files with 10 additions and 2 deletions
|
|
@ -368,7 +368,7 @@ end
|
|||
|
||||
-- #################################
|
||||
|
||||
function alert_utils.getNumAlertsPerHour(what, epoch_begin, epoch_end, alert_type, alert_severity)
|
||||
function alert_utils.getNumAlertsPerHour(what, epoch_begin, epoch_end, alert_type, alert_severity, host_info)
|
||||
local opts = {
|
||||
epoch_begin = epoch_begin,
|
||||
epoch_end = epoch_end,
|
||||
|
|
@ -376,6 +376,12 @@ function alert_utils.getNumAlertsPerHour(what, epoch_begin, epoch_end, alert_typ
|
|||
alert_severity = alert_severity,
|
||||
}
|
||||
|
||||
if host_info and host_info.host then
|
||||
local entity_info = alerts_api.hostAlertEntity(host_info.host, host_info.vlan)
|
||||
opts.entity = entity_info.alert_entity.entity_id
|
||||
opts.entity_val = entity_info.alert_entity_val
|
||||
end
|
||||
|
||||
return performAlertsQuery("select (alert_tstamp - alert_tstamp % 3600) as hour, count(*) count", what, opts, nil, "hour")
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue