Email Notifications-HTML code in service output not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
scomdco
Posts: 45
Joined: Fri Oct 04, 2019 3:18 pm

Email Notifications-HTML code in service output not working

Post 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>
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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.
scomdco
Posts: 45
Joined: Fri Oct 04, 2019 3:18 pm

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

Post 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
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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!
scomdco
Posts: 45
Joined: Fri Oct 04, 2019 3:18 pm

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

Post 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!
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
scomdco
Posts: 45
Joined: Fri Oct 04, 2019 3:18 pm

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

Post 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!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked