Move host log alerts to host alerts. Fix syslog alerts.

This commit is contained in:
Alfredo Cardigliano 2021-05-03 17:37:18 +02:00
parent d78ce33cb0
commit 8dd0f903a1
7 changed files with 29 additions and 16 deletions

View file

@ -4,7 +4,7 @@
-- ##############################################
local other_alert_keys = require "other_alert_keys"
local host_alert_keys = require "host_alert_keys"
local alert_creators = require "alert_creators"
-- Import the classes library.
local classes = require "classes"
@ -13,12 +13,12 @@ local alert = require "alert"
-- ##############################################
local alert_host_log = classes.class(alert)
local host_alert_host_log = classes.class(alert)
-- ##############################################
alert_host_log.meta = {
alert_key = other_alert_keys.alert_host_log,
host_alert_host_log.meta = {
alert_key = host_alert_keys.host_alert_host_log,
i18n_title = "alerts_dashboard.host_log",
icon = "fa fa-file-text-o",
}
@ -27,14 +27,14 @@ alert_host_log.meta = {
-- @brief Prepare an alert table used to generate the alert
-- @param host The string with the name or ip address of the host
-- @return A table with the alert built
function alert_host_log:init(host, level, facility, message)
function host_alert_host_log:init(host, level, facility, message)
-- Call the parent constructor
self.super:init()
self.alert_type_params = {
host = host,
facility = facility,
message = message,
host = host,
facility = facility,
message = message,
}
end
@ -45,7 +45,7 @@ end
-- @param alert The alert description table, including alert data such as the generating entity, timestamp, granularity, type
-- @param alert_type_params Table `alert_type_params` as built in the `:init` method
-- @return A human-readable string
function alert_host_log.format(ifid, alert, alert_type_params)
function host_alert_host_log.format(ifid, alert, alert_type_params)
local hostinfo = hostkey2hostinfo(alert.entity_val)
return(i18n("alert_messages.host_log", {
@ -58,4 +58,4 @@ end
-- #######################################################
return alert_host_log
return host_alert_host_log