Alert on software update

This commit is contained in:
Alfredo Cardigliano 2020-01-08 18:51:21 +01:00
parent 76391ff6a5
commit 5e5d50d72a
3 changed files with 15 additions and 1 deletions

View file

@ -2353,6 +2353,13 @@ local function notify_ntopng_status(started)
local event
if(started) then
-- reading current version and last version to check if it has been updated
local last_version_key = "ntopng.updates.last_version"
local last_version = ntop.getCache(last_version_key)
local curr_version = info["version"].."-"..info["revision"]
ntop.setCache(last_version_key, curr_version)
-- let's check if we are restarting from an anomalous termination
-- e.g., from a crash
if not recovery_utils.check_clean_shutdown() then
@ -2361,8 +2368,12 @@ local function notify_ntopng_status(started)
severity = alertSeverity("error")
anomalous = true
event = "anomalous_termination"
elseif not isEmptyString(last_version) and last_version ~= curr_version then
-- software update
msg = string.format("%s %s", i18n("alert_messages.ntopng_update"), msg_details)
event = "update"
else
-- normal termination
-- normal termination
msg = string.format("%s %s", i18n("alert_messages.ntopng_start"), msg_details)
event = "start"
end