Page 1 of 1

Colorized notifications

Posted: Wed Feb 13, 2019 9:52 pm
by BanditBBS
So, I manage someones XI that is 5.5.x and their notifications are colored using this method in the messages:

Code: Select all

<style type='text/css'>.OK {color:green;}.WARNING {color:yellow;}.UNKNOWN {color:orange}.CRITICAL {color:red}</style>
<h2 class='%servicestate%'>***** Nagios XI Alert *****</h2>
My XI is still only 5.4.12 and if I try it with the exact same code, no colors :(

Before I keep troubleshooting this, is this something that only works in 5.5x or should it be working in 5.4.x also?

Or is there a setting somewhere that I am missing?

Re: Colorized notifications

Posted: Wed Feb 13, 2019 10:40 pm
by BanditBBS
So I found the KB article, seems I am doing everything needed.

I think it is a limitation of gmail, we do use GSuite at my company. Anyone found a way around the limitation in gmail? They used to not allow any css but now do allow a style block: https://developers.google.com/gmail/design/css

Re: Colorized notifications

Posted: Thu Feb 14, 2019 1:02 pm
by scottwilkerson
I just tested this and it worked

Place the following in the "Service Alert Message":

Code: Select all

<html>
  <head>
    <style>.OK {color:green;}.WARNING {color:yellow;}.UNKNOWN {color:orange}.CRITICAL {color:red}</style>
  </head>
  <body>
    <h2 class='%servicestate%'>***** Nagios XI Alert *****</h2>
    <pre>
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %hostalias%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
    </pre>
  </body>
</html>
The noted difference is I changed

Code: Select all

<style type='text/css'>
to this

Code: Select all

<style>
And I placed it all in full <html> tags with the

Code: Select all

<style>
in the head just like their example

Re: Colorized notifications

Posted: Thu Feb 14, 2019 1:12 pm
by BanditBBS
@scottwilkerson

Worked like a charm sir, thanks!

Have someone update https://support.nagios.com/kb/article.php?id=527 for Gmail :)

Re: Colorized notifications

Posted: Thu Feb 14, 2019 1:31 pm
by scottwilkerson
BanditBBS wrote:Have someone update https://support.nagios.com/kb/article.php?id=527 for Gmail :)
done!