From d680e2d7c8213baa388097a21898e44f8de0c920 Mon Sep 17 00:00:00 2001 From: everpcpc Date: Tue, 9 Mar 2021 11:16:51 +0800 Subject: [PATCH] fix(icinga): indent format in notification template --- .../templates/icinga/notification.mako | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/sa_tools_core/templates/icinga/notification.mako b/sa_tools_core/templates/icinga/notification.mako index 81f187e..a7d82f6 100644 --- a/sa_tools_core/templates/icinga/notification.mako +++ b/sa_tools_core/templates/icinga/notification.mako @@ -160,22 +160,27 @@ Host: ${env.NAGIOS_HOSTALIAS} Duration: ${env.NAGIOS_HOSTDURATION} Date/Time: ${env.NAGIOS_LONGDATETIME} Additional Info: -%if notify_type == 'wework': + %if notify_type == 'wework': + %if env.NAGIOS_HOSTOUTPUT: > ${env.NAGIOS_HOSTOUTPUT} + %endif + %if env.NAGIOS_LONGHOSTOUTPUT: > ${env.NAGIOS_LONGHOSTOUTPUT} - -%elif notify_type == 'telegram': + %endif +| + %elif notify_type == 'telegram': ``` ${env.NAGIOS_HOSTOUTPUT} ${env.NAGIOS_LONGHOSTOUTPUT} ``` -%else: + %else: ${env.NAGIOS_HOSTOUTPUT} ${env.NAGIOS_LONGHOSTOUTPUT} -%endif - %if env.NOTIFICATIONAUTHORNAME: + %endif + + %if env.NOTIFICATIONAUTHORNAME: Comment: [${env.NOTIFICATIONAUTHORNAME}] ${env.NOTIFICATIONCOMMENT} - %endif + %endif %elif env.TARGET_TYPE == 'service': @@ -183,26 +188,27 @@ ${short_env.time} ${'Duration: %s' % env.NAGIOS_SERVICEDURATION if env.SERVICE_DURATION_SEC and float(env.SERVICE_DURATION_SEC) > 1 else ''} ${'Contacts: %s' % env.NAGIOS__SERVICECONTACT if env.NAGIOS__SERVICECONTACT else ''} Additional Info: -%if notify_type == 'wework': -%if env.NAGIOS_SERVICEOUTPUT: + %if notify_type == 'wework': + %if env.NAGIOS_SERVICEOUTPUT: > ${env.NAGIOS_SERVICEOUTPUT} -%endif -%if env.NAGIOS_LONGSERVICEOUTPUT: + %endif + %if env.NAGIOS_LONGSERVICEOUTPUT: > ${env.NAGIOS_LONGSERVICEOUTPUT} -%endif + %endif | -%elif notify_type == 'telegram': + %elif notify_type == 'telegram': ``` ${env.NAGIOS_SERVICEOUTPUT} ${env.NAGIOS_LONGSERVICEOUTPUT} ``` -%else: + %else: ${env.NAGIOS_SERVICEOUTPUT} ${env.NAGIOS_LONGSERVICEOUTPUT} -%endif - %if env.NOTIFICATIONAUTHORNAME: + %endif + + %if env.NOTIFICATIONAUTHORNAME: Comment: [${env.NOTIFICATIONAUTHORNAME}] ${env.NOTIFICATIONCOMMENT} - %endif + %endif %endif