summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-03-11 08:24:38 +0100
committervarac <varacanero@zeromail.org>2016-03-11 08:25:50 +0100
commit11f3c6f95d9492d4943aacb510458fb5a407e9fb (patch)
tree9a2bd053242ee6857ab6622398abd99b8bdb8e10
parentf062559072e7d4281c114d799208a3d093a74a47 (diff)
Improve notification mails
The mail subject line is too long for some mail clients, so i removed the $NOTIFICATIONTYPE$ variable from it, because it is not needed to understand the problem/recovery. This is an example of a mail send out using this change: Subject: WARNING - aardwolf: APT ***** Nagios ***** Notification Type: PROBLEM Host: aardwolf.unstable.bitmask.i (aardwolf) Address: 199.119.112.205 Service: APT State: WARNING Duration: 0d 0h 13m 5s Date/Time: Fri Jan 15 10:04:55 UTC 2016 Output: WARN - APT WARNING: 20 packages available for upgrade (0 critical updates). Before it looked like this: Subject: ** PROBLEM Service Alert: aardwolf/APT is WARNING ** ***** Nagios ***** Notification Type: PROBLEM Service: APT Host: aardwolf Address: 199.119.112.205 State: WARNING Date/Time: Thu Mar 10 21:57:23 UTC 2016 Additional Info: WARN - APT WARNING: 1 packages available for upgrade (0 critical updates).
-rw-r--r--manifests/defaults/commands.pp4
1 files changed, 2 insertions, 2 deletions
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp
index e80e147..0f24411 100644
--- a/manifests/defaults/commands.pp
+++ b/manifests/defaults/commands.pp
@@ -136,9 +136,9 @@ class nagios::defaults::commands {
default: {
nagios_command {
'notify-host-by-email':
- command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\nHost: \$HOSTNAME\$\\nState: \$HOSTSTATE\$\\nAddress: \$HOSTADDRESS\$\\nInfo: \$HOSTOUTPUT\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Host Alert: \$HOSTNAME\$ is \$HOSTSTATE\$ **\" \$CONTACTEMAIL\$";
+ command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nHost: \$HOSTNAME\$ (\$HOSTALIAS\$)\\nAddress: \$HOSTADDRESS\$\\nState: \$HOSTSTATE\$\\nDuration: \$HOSTDURATION\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nOutput: \$HOSTOUTPUT\$\" | ${mail_cmd_location} -s \"\$NOTIFICATIONTYPE\$: \$HOSTSTATE\$ - \$HOSTNAME\$\" \$CONTACTEMAIL\$";
'notify-service-by-email':
- command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nService: \$SERVICEDESC\$\\nHost: \$HOSTALIAS\$\\nAddress: \$HOSTADDRESS\$\\nState: \$SERVICESTATE\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nAdditional Info:\\n\\n\$SERVICEOUTPUT\$\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Service Alert: \$HOSTALIAS\$/\$SERVICEDESC\$ is \$SERVICESTATE\$ **\" \$CONTACTEMAIL\$";
+ command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nHost: \$HOSTNAME\$ (\$HOSTALIAS\$)\\nAddress: \$HOSTADDRESS\$\\n\\nService: \$SERVICEDESC\$\\nState: \$SERVICESTATE\$\\nDuration: \$SERVICEDURATION\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nOutput: \$SERVICEOUTPUT\$\" | ${mail_cmd_location} -s \"\$NOTIFICATIONTYPE\$: \$SERVICESTATE\$ - \$HOSTALIAS\$/\$SERVICEDESC\$\" \$CONTACTEMAIL\$";
}
}
}