Drop hour stats when the host is edited

This commit is contained in:
emanuele-f 2020-04-28 15:33:42 +02:00
parent f6949452c3
commit 675d8ce8ab
2 changed files with 14 additions and 5 deletions

View file

@ -163,10 +163,13 @@ elseif(action == "edit") then
local old_iface = tostring(interface.getId())
interface.select(getSystemInterfaceId())
-- Always release the old alert because:
-- - If the granularity has changed, since the alert is bound to a specific granularity, it must be released
-- - If the threshold has changed, we want to change the threshold in the alert message (if engaged)
am_utils.releaseAlert(last_update.ip, key, value, threshold, old_granularity)
-- Drop the hour stats
am_utils.dropHourStats(key)
-- Always release the old alert because:
-- - If the granularity has changed, since the alert is bound to a specific granularity, it must be released
-- - If the threshold has changed, we want to change the threshold in the alert message (if engaged)
am_utils.releaseAlert(last_update.ip, key, value, threshold, old_granularity)
if am_utils.hasExceededThreshold(threshold, m_info.operator, value) then
am_utils.triggerAlert(last_update.ip, key, value, threshold, granularity)