mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Add v1/get/alert/ts.lua REST API (implement #3943
This commit is contained in:
parent
09ea665c9b
commit
21fe9aa490
2 changed files with 123 additions and 0 deletions
|
|
@ -359,6 +359,23 @@ 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,
|
||||
alert_type = alert_type,
|
||||
alert_severity = alert_severity,
|
||||
}
|
||||
|
||||
results = performAlertsQuery("select (alert_tstamp - alert_tstamp % 3600) as hour, count(*) count", what, opts, nil, "hour")
|
||||
|
||||
return results
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
local function refreshAlerts(ifid)
|
||||
ntop.delCache(string.format("ntopng.cache.alerts.ifid_%d.has_alerts", ifid))
|
||||
ntop.delCache("ntopng.cache.update_alerts_stats_time")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue