Add v1/get/alert/ts.lua REST API (implement #3943

This commit is contained in:
Alfredo Cardigliano 2020-05-26 12:28:33 +02:00
parent 09ea665c9b
commit 21fe9aa490
2 changed files with 123 additions and 0 deletions

View file

@ -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")