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:50] – [Changelog] helgealerts:html_mail2.0 [2016/03/21 08:17] – [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 27: Line 27:
 chmod 755 html_mail.pl</code> chmod 755 html_mail.pl</code>
   - 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 RECOVERED</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 RECOVERED INFO </code> 
 +   
 +    
 +  - And of course you replace [XYMON_SERVER_ROOT] with the full path to your xymon server directory  
 +(e.g. /home/xymon/server ).
  
 ===== Source ===== ===== Source =====
Line 63: 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 68: Line 76:
    
 use strict; use strict;
-use lib "/home/xymon/lib/perl";+# only necessary if you have no access to the perl system libs 
 +use lib "/home/xymon/lib/perl"; 
 use MIME::Lite; use MIME::Lite;
    
Line 110: Line 120:
 my $FLAPPING; # Flapping my $FLAPPING; # Flapping
 my $FLAPPM=" "; # Flapping Message my $FLAPPM=" "; # Flapping Message
- +my $DISABLE; # Disable Flag
    
 ############################################################################### ###############################################################################
Line 185: Line 195:
  $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 236: Line 262:
 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;
  • alerts/html_mail2.0.txt
  • Last modified: 2016/03/21 11:58
  • by helge