alerts:html_mail2.0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
alerts:html_mail2.0 [2016/03/21 07:49] – [Changelog] helgealerts:html_mail2.0 [2016/03/21 08:08] – [Installation] helge
Line 1: Line 1:
-====== My Alert (CHANGEME) ======+====== Advanced HTML/Plain Alarm Mail ======
  
 ^ Author | [[ helge.jacobsen@atos.net | Helge Jacobsen]] | ^ Author | [[ helge.jacobsen@atos.net | Helge Jacobsen]] |
Line 5: Line 5:
 ^ Requirements | Perl, MIME::Lite | ^ Requirements | Perl, MIME::Lite |
 ^ Download | None | ^ Download | None |
-^ Last Update | 2016-03-14 |+^ Last Update | 2016-03-21 |
  
 ===== Description ===== ===== Description =====
Line 15: Line 15:
   * Flapping Status included in Subject and Mailtext   * Flapping Status included in Subject and Mailtext
   * Colorstatus depends on BBALPHAMSG for Recover Status. Nesessary if you using yellow for   OKCOLOR   * Colorstatus depends on BBALPHAMSG for Recover Status. Nesessary if you using yellow for   OKCOLOR
 +  * Add Enable/Disable Mail Subject / Removing Backgroundcolor: not accessible in Outlook and makes mails in Thunderbird unreadable
 +  * Fix for disable "until okay": Convert XYmon Recover Bodytext "for -1 minutes" to "until okay"
  
  
  
- +Tested with Outlook 2010 and Thunderbird
-Tested with Outlook 2010+
  
 ===== Installation ===== ===== Installation =====
Line 27: Line 28:
   - Add the following line in whichever alert for which you want messages <code>   - Add the following line in whichever alert for which you want messages <code>
   SCRIPT [XYMON_SERVER_ROOT]/ext/html_mail.pl [RECIPIENT] FORMAT=PLAIN</code>   SCRIPT [XYMON_SERVER_ROOT]/ext/html_mail.pl [RECIPIENT] FORMAT=PLAIN</code>
-  - And of course you replace [XYMON_SERVER_ROOT] with the full path to your xymon server directory (e.g. /usr/lib/hobbit/server ).+  If you want enable/disable notification : <code> 
 +  SCRIPT [XYMON_SERVER_ROOT]/ext/html_mail.pl [RECIPIENT] FORMAT=PLAIN INFO </code> 
 +   
 +    
 +  - And of course you replace [XYMON_SERVER_ROOT] with the full path to your xymon server directory  
 +(e.g. /usr/lib/hobbit/server ).
  
 ===== Source ===== ===== Source =====
Line 62: Line 68:
 # 1.7 Helge Jacobsen Add Flapping Status  # 1.7 Helge Jacobsen Add Flapping Status 
 # 2.0 Helge Jacobsen  Add Colorstatus depends on BBALPHAMSG for Recover Status. Nesessary if you using yellow for OKCOLORS 2016-03-11 running on XYmon 4.3.26 # 2.0 Helge Jacobsen  Add Colorstatus depends on BBALPHAMSG for Recover Status. Nesessary if you using yellow for OKCOLORS 2016-03-11 running on XYmon 4.3.26
 +# 2.01 Helge Jacobsen Add Enable/Disable Mail Subject / Removing Backgroundcolor: not accessible in Outlook and makes mails in Thunderbird unreadable 
 +# 2.02 Helge Jacobsen Fix for disable "until okay": Convert XYmon Recover Bodytext "for -1 minutes" to "until okay"
 +
    
 ############################################################################### ###############################################################################
Line 109: Line 118:
 my $FLAPPING; # Flapping my $FLAPPING; # Flapping
 my $FLAPPM=" "; # Flapping Message my $FLAPPM=" "; # Flapping Message
- +my $DISABLE; # Disable Flag
    
 ############################################################################### ###############################################################################
Line 184: Line 193:
  $SUBJECT = "is Flapping";  $SUBJECT = "is Flapping";
  }  }
 + #
 + # Disable Detection
 + $DISABLE=(split(/ /, $BBALPHAMSG))[1];
 + if ($DISABLE =~ /INFO/) {
 + if ($BBALPHAMSG =~ /DISABLED/) {
 + $SUBJECT = "is DISABLED" ;
 + }
 + if ($BBALPHAMSG =~ /ENABLED/) {
 + $SUBJECT = "is ENABLED" ;
 + }
 + $BBCOLORLEVEL = "Info";
 +        }
 +  # Convert XYmon Recover Bodytext "for -1 minutes" to until okay
 +         $BBHTMLMSG =~ s/for -1 minutes/until Service is okay/g;
 +
 +        #
   
  #   #
Line 235: Line 260:
 EOF EOF
         my $link .= "http://$BBSERVERWWWNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";         my $link .= "http://$BBSERVERWWWNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";
-        $htmldata .= "$HTML_BODY\n<FONT FACE=\"Tahoma, Arial, Helvetica\" SIZE=\"3\"> +#        $htmldata .= "$HTML_BODY\n<FONT FACE=\"Tahoma, Arial, Helvetica\" SIZE=\"3\"> 
-$FLAPPM <p> See <a href=\"$link\">$link</a><BR>+        $htmldata .= "<FONT FACE=\"Tahoma, Arial, Helvetica\" SIZE=\"3\"> 
 + $FLAPPM <p> See <a href=\"$link\">$link</a><BR>
 <PRE>$BBHTMLMSG\n$RECOEVENT Event Duration Time:  $DOWNSECS Secs\n</PRE>\n</FONT>\n</BODY>"; <PRE>$BBHTMLMSG\n$RECOEVENT Event Duration Time:  $DOWNSECS Secs\n</PRE>\n</FONT>\n</BODY>";
  return $htmldata;  return $htmldata;
Line 295: Line 321:
  
   * **2016-03-14**   * **2016-03-14**
-    * Initial release+    * 2.0 Initial release 
   * **2016-03-21**   * **2016-03-21**
-    * Little Fix and a smart update+    * 2.02 Little Fix and a smart update
  
  • alerts/html_mail2.0.txt
  • Last modified: 2016/03/21 11:58
  • by helge