Page 1 of 1

Email Notifications-HTML code in service output not working

Posted: Mon Nov 25, 2019 4:46 pm
by scomdco
Notification emails we receive are not acknowledging HTML code, the same html code is acknowledged within the Nagios XI GUI, but not in the emails.

Here's the output of one of the service checks. It's acknowledging any of the HTML code within the script, (Underline,Bold,Break), i redacted some info for security purposes.
htmlemail3.png
Here's the output in the email, you can see the raw html code within the output
htmlemail1.png
Here's another example where just Bold is supposed to apply
htmlemail.png
scottwilkerson stated this prior, if you're reading this and have any insight we'd love to hear it!
I am going to speculate that the output just has newline seperators and not html <br> tags which would make this expected output.

The only way I can see around this would be to change the email template to wrap %serviceoutput% in a pre tag, like

Code: Select all

<pre>%serviceoutput%</pre>

Re: Email Notifications-HTML code in service output not work

Posted: Mon Nov 25, 2019 5:38 pm
by ssax
Please click on the username in the top right hand corner of the XI web interface:
- On the left hand side click Notification Methods
- Make sure the box is unchecked for Receive emails in plain text only.

Re: Email Notifications-HTML code in service output not work

Posted: Tue Nov 26, 2019 9:47 am
by scomdco
in regards to scottwilkerson,
This was my stab at applying your suggestion, let me know if this is not the correct place to put it
notemeth.png
in regards to ssax, i was really hoping that was going to be it, but the box was unchecked when i found it
servicecheck.png

Re: Email Notifications-HTML code in service output not work

Posted: Tue Nov 26, 2019 2:28 pm
by ssax
That plain text setting would be per-user, are you sure you were logged in as the user that received that specific notification?

Which contacts was it sent to? Check Home > Notifications and send a screenshot please.

Please PM one of us a copy of your profile as well, you can download it from Admin > System Profile > Download Profile and upload it to the ticket by clicking the "choose item" link at the bottom of the menu.

Thank you!

Re: Email Notifications-HTML code in service output not work

Posted: Tue Nov 26, 2019 8:20 pm
by scomdco
Notification Emails are sent to the user dco, here's one line for example from the Notifications section,
dcoalert.png
i found the box is unchecked for the user dco after logging into it and taking a look. I took a big SS so you can see what user is signed in
dcouser.png
I've PMed both of you with my Profile, hoping you find something!

Re: Email Notifications-HTML code in service output not work

Posted: Wed Nov 27, 2019 7:27 am
by scottwilkerson
Your nagios.cfg contains this line

Code: Select all

illegal_macro_output_chars=`~$&|'"<>
# ILLEGAL MACRO OUTPUT CHARACTERS
# This option allows you to specify illegal characters that are
# stripped from macros before being used in notifications, event
# handlers, etc. This DOES NOT affect macros used in service or
# host check commands.
# The following macros are stripped of the characters you specify:
# $HOSTOUTPUT$
# $HOSTPERFDATA$
# $HOSTACKAUTHOR$
# $HOSTACKCOMMENT$
# $SERVICEOUTPUT$
# $SERVICEPERFDATA$
# $SERVICEACKAUTHOR$
# $SERVICEACKCOMMENT$
You would need to remove <> if your output is actually returning those chars as part of the HTML returned from the plugin

Then restart nagios

Code: Select all

service nagios restart

Re: Email Notifications-HTML code in service output not work

Posted: Wed Nov 27, 2019 10:01 am
by scomdco
Removing <> worked!

I can't thank you enough for resolving this issue. The time you both put into it is much appreciated. This thread can be locked!

Re: Email Notifications-HTML code in service output not work

Posted: Wed Nov 27, 2019 10:19 am
by scottwilkerson
scomdco wrote:Removing <> worked!

I can't thank you enough for resolving this issue. The time you both put into it is much appreciated. This thread can be locked!
Awesome...

Locking thread