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
alerts:html_mail2.0 [2016/03/21 07:50] – [Changelog] helgealerts:html_mail2.0 [2016/03/21 11:58] (current) – [Installation] helge
Line 1: Line 1:
-====== My Alert (CHANGEME) ======+====== Advanced HTML Mail Alarm ======
  
 ^ 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 26: Line 26:
   -Make the script executable:<code>   -Make the script executable:<code>
 chmod 755 html_mail.pl</code> chmod 755 html_mail.pl</code>
 +  -Be sure that you have MIME::Lite.pm
 +
   - 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 NOTICE </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 70:
 # 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 78:
    
 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 122:
 my $FLAPPING; # Flapping my $FLAPPING; # Flapping
 my $FLAPPM=" "; # Flapping Message my $FLAPPM=" "; # Flapping Message
- +my $DISABLE; # Disable Flag
    
 ############################################################################### ###############################################################################
Line 185: Line 197:
  $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 264:
 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 296: Line 325:
  
   * **2016-03-14**   * **2016-03-14**
-    * Initial release 2.00+    * 2.0 Initial release 
   * **2016-03-21**   * **2016-03-21**
-    * Little Fix and a smart update 2.02+    * 2.02 Little Fix and a smart update
  
  • alerts/html_mail2.0.1458546619.txt.gz
  • Last modified: 2016/03/21 07:50
  • by helge