mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Add rest/v1/get/alert/type/counters.lua API REST (implement #3948)
This commit is contained in:
parent
48f0b2a3cc
commit
7c977a3ebc
2 changed files with 57 additions and 4 deletions
|
|
@ -360,8 +360,6 @@ end
|
|||
-- #################################
|
||||
|
||||
function alert_utils.getNumAlertsPerHour(what, epoch_begin, epoch_end, alert_type, alert_severity)
|
||||
local results = {}
|
||||
|
||||
local opts = {
|
||||
epoch_begin = epoch_begin,
|
||||
epoch_end = epoch_end,
|
||||
|
|
@ -369,9 +367,15 @@ function alert_utils.getNumAlertsPerHour(what, epoch_begin, epoch_end, alert_typ
|
|||
alert_severity = alert_severity,
|
||||
}
|
||||
|
||||
results = performAlertsQuery("select (alert_tstamp - alert_tstamp % 3600) as hour, count(*) count", what, opts, nil, "hour")
|
||||
return performAlertsQuery("select (alert_tstamp - alert_tstamp % 3600) as hour, count(*) count", what, opts, nil, "hour")
|
||||
end
|
||||
|
||||
return results
|
||||
-- #################################
|
||||
|
||||
function alert_utils.getNumAlertsPerType(what)
|
||||
local opts = {}
|
||||
|
||||
return performAlertsQuery("select alert_type id, count(*) count", what, opts, nil, "alert_type" --[[ group by ]])
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue