Skip to content

Commit

Permalink
Update verbiage for notifications (Host)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cat5TV committed Jan 12, 2019
1 parent a144c85 commit 13194af
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions data/1.5/nagios/plugins/nems_sendmail_host
Expand Up @@ -83,51 +83,61 @@ if($f_notify_type=="PROBLEM") {
$f_color="#FF0000"; $f_color="#FF0000";
$f_ackauthor_desc="Acknowledged By:"; $f_ackauthor_desc="Acknowledged By:";
$f_ackcomment_desc="Comment:"; $f_ackcomment_desc="Comment:";
$f_notify_type_friendly = 'Host Problem';
} }
if($f_notify_type=="RECOVERY") { if($f_notify_type=="RECOVERY") {
$f_color="#006800"; $f_color="#006800";
$f_ackauthor_desc="Acknowledged By:"; $f_ackauthor_desc="Acknowledged By:";
$f_ackcomment_desc="Comment:"; $f_ackcomment_desc="Comment:";
$f_notify_type_friendly = 'Recovered';
} }
if($f_notify_type=="ACKNOWLEDGEMENT") { if($f_notify_type=="ACKNOWLEDGEMENT") {
$f_color="#AEB6BF"; $f_color="#AEB6BF";
$f_ackauthor_desc="Acknowledged By:"; $f_ackauthor_desc="Acknowledged By:";
$f_ackcomment_desc="Comment:"; $f_ackcomment_desc="Comment:";
$f_notify_type_friendly = 'Problem Acknowledged';
} }
if($f_notify_type=="FLAPPINGSTART") { if($f_notify_type=="FLAPPINGSTART") {
$f_color="#800000"; $f_color="#800000";
$f_ackauthor_desc="Flapping Author:"; $f_ackauthor_desc="Flapping Author:";
$f_ackcomment_desc="Flapping Comment:"; $f_ackcomment_desc="Flapping Comment:";
$f_notify_type_friendly = 'Host Started Flapping';
} }
if($f_notify_type=="FLAPPINGSTOP") { if($f_notify_type=="FLAPPINGSTOP") {
$f_color="#008000"; $f_color="#008000";
$f_ackauthor_desc="Flapping Author:"; $f_ackauthor_desc="Flapping Author:";
$f_ackcomment_desc="Flapping Comment:"; $f_ackcomment_desc="Flapping Comment:";
$f_notify_type_friendly = 'Host Has Stopped Flapping';
} }
if($f_notify_type=="FLAPPINGDISABLED") { if($f_notify_type=="FLAPPINGDISABLED") {
$f_color="#F7FE2E"; $f_color="#F7FE2E";
$f_ackauthor_desc="Flapping Author:"; $f_ackauthor_desc="Flapping Author:";
$f_ackcomment_desc="Flapping Comment:"; $f_ackcomment_desc="Flapping Comment:";
$f_notify_type_friendly = 'Flapping Disabled';
} }
if($f_notify_type=="DOWNTIMESTART") { if($f_notify_type=="DOWNTIMESTART") {
$f_color="#5DADE2"; $f_color="#5DADE2";
$f_ackauthor_desc="Scheduled Downtime by:"; $f_ackauthor_desc="Scheduled Downtime by:";
$f_ackcomment_desc="Comment for Scheduled Downtime:"; $f_ackcomment_desc="Comment for Scheduled Downtime:";
$f_notify_type_friendly = 'Begin Scheduled Downtime';
} }
if($f_notify_type=="DOWNTIMEEND") { if($f_notify_type=="DOWNTIMEEND") {
$f_color="#48C9B0"; $f_color="#48C9B0";
$f_ackauthor_desc="Scheduled Downtime by:"; $f_ackauthor_desc="Scheduled Downtime by:";
$f_ackcomment_desc="Comment for Scheduled Downtime:"; $f_ackcomment_desc="Comment for Scheduled Downtime:";
$f_notify_type_friendly = 'End Scheduled Downtime';
} }
if($f_notify_type=="DOWNTIMECANCELLED") { if($f_notify_type=="DOWNTIMECANCELLED") {
$f_color="#AF7AC5"; $f_color="#AF7AC5";
$f_ackauthor_desc="Scheduled Downtime by:"; $f_ackauthor_desc="Scheduled Downtime by:";
$f_ackcomment_desc="Comment for Scheduled Downtime:"; $f_ackcomment_desc="Comment for Scheduled Downtime:";
$f_notify_type_friendly = 'Scheduled Downtime Has Been Cancelled';
} }
if($f_notify_type=="CUSTOM") { if($f_notify_type=="CUSTOM") {
$f_color="#5D6D7E"; $f_color="#5D6D7E";
$f_ackauthor_desc="Custom Author:"; $f_ackauthor_desc="Custom Author:";
$f_ackcomment_desc="Custom Comment:"; $f_ackcomment_desc="Custom Comment:";
$f_notify_type_friendly = 'Custom Notification';
} }


/* Check if acknowledgement is present and if so, then add HTML code */ /* Check if acknowledgement is present and if so, then add HTML code */
Expand Down Expand Up @@ -175,7 +185,7 @@ if($f_notification_escalation_state==1){
$message = ' $message = '
***** NEMS Linux ***** ***** NEMS Linux *****
Notification Type: ' .$f_notify_type. ' Notification Type: ' .($f_notify_type_friendly ?: $f_notify_type). '
Host: ' .$f_host_name. ' Host: ' .$f_host_name. '
Host Alias: ' .$f_host_alias. ' Host Alias: ' .$f_host_alias. '
State: ' .$f_host_state. ' State: ' .$f_host_state. '
Expand Down Expand Up @@ -328,7 +338,7 @@ $HTMLmessage = '
<center style="width: 100%; background: #f6f6f6; text-align: left;"> <center style="width: 100%; background: #f6f6f6; text-align: left;">
<div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: sans-serif;"> <div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: sans-serif;">
[' .$f_notify_type. '] Host: ' .$f_host_alias. ' (' .$f_host_name. ') is ' .$f_host_state. '. *************************************************************************************************************************************** [' .($f_notify_type_friendly ?: $f_notify_type). '] Host: ' .$f_host_alias. ' (' .$f_host_name. ') is ' .$f_host_state. '. ***************************************************************************************************************************************
</div> </div>
<div style="padding: 10px 0; margin: auto;" class="email-container"> <div style="padding: 10px 0; margin: auto;" class="email-container">
Expand All @@ -350,7 +360,7 @@ $HTMLmessage = '
</tr> </tr>
<tr> <tr>
<td style="background-color:' .$f_color. ';"> <td style="background-color:' .$f_color. ';">
<h1 style="font-family: CoconPro-BoldCond, Open Sans, Verdana, sans-serif; padding:0; margin:10px; color:#ffffff; text-align:center;">' .$f_notify_type. '</h1> <h1 style="font-family: CoconPro-BoldCond, Open Sans, Verdana, sans-serif; padding:0; margin:10px; color:#ffffff; text-align:center;">' .($f_notify_type_friendly ?: $f_notify_type). '</h1>
</td> </td>
</tr> </tr>
</tbody> </tbody>
Expand Down Expand Up @@ -452,7 +462,7 @@ $HTMLmessage = '
<tbody> <tbody>
<tr> <tr>
<td style="background-color:' .$f_color. ';"> <td style="background-color:' .$f_color. ';">
<h1 style="font-family: CoconPro-BoldCond, Open Sans, Verdana, sans-serif; padding:0; margin:10px; color:#ffffff; text-align:center;">' .$f_notify_type. '</h1> <h1 style="font-family: CoconPro-BoldCond, Open Sans, Verdana, sans-serif; padding:0; margin:10px; color:#ffffff; text-align:center;">' .($f_notify_type_friendly ?: $f_notify_type). '</h1>
</td> </td>
</tr> </tr>
<tr> <tr>
Expand Down Expand Up @@ -516,7 +526,7 @@ $mail->addAddress($f_to); // Add a recipient + Name is optional "$mail->addAddre
$mail->isHTML(true); // Set email format to HTML $mail->isHTML(true); // Set email format to HTML
$mail->WordWrap = 50; // Set word wrap to 50 characters $mail->WordWrap = 50; // Set word wrap to 50 characters


$mail->Subject = '*** '.$f_notify_type.': '.$f_host_name.' is '.$f_host_state.' ***'; $mail->Subject = '*** '.($f_notify_type_friendly ?: $f_notify_type).': '.$f_host_name.' is '.$f_host_state.' ***';
$mail->AltBody = $message; $mail->AltBody = $message;
$mail->Body = $HTMLmessage; $mail->Body = $HTMLmessage;


Expand Down

0 comments on commit 13194af

Please sign in to comment.