Fix message

This commit is contained in:
Alfredo Cardigliano 2023-02-16 17:47:56 +01:00
parent 21f75ed0af
commit b15bd6c965
2 changed files with 7 additions and 4 deletions

View file

@ -53,13 +53,16 @@ function syslog_module.hooks.handleEvent(syslog_conf, message, host, priority)
if event then
local event_type = event.event
local reason = ''
if event_type == 'stop' and not isEmptyString(event.exit_status) and event.exit_status ~= '0' then
event_type = 'failure'
reason = '[' .. event.exit_status .. ']'
end
local message = i18n("alert_messages.nbox_service", {service=event.service_name, host=event.hostname, ip=host, reason=event.exit_status})
local message = i18n("alert_messages.nbox_service", {service=event.service_name, host=event.hostname, ip=host, reason=reason})
if not isEmptyString(event.instance_name) then
message = i18n("alert_messages.nbox_service_instance", {service=event.service_name, instance=event.instance_name, host=event.hostname, ip=host, reason=event.exit_status})
message = i18n("alert_messages.nbox_service_instance", {service=event.service_name, instance=event.instance_name, host=event.hostname, ip=host, reason=reason})
end
local is_alert = syslog_utils.handle_system_event(host, event.service_name, event_type, message, priority,