Colorized notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Colorized notifications

Post 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?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Colorized notifications

Post 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
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Colorized notifications

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Colorized notifications

Post by BanditBBS »

@scottwilkerson

Worked like a charm sir, thanks!

Have someone update https://support.nagios.com/kb/article.php?id=527 for Gmail :)
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Colorized notifications

Post by scottwilkerson »

BanditBBS wrote:Have someone update https://support.nagios.com/kb/article.php?id=527 for Gmail :)
done!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked