Tags: patch
In fact the error comes from the configure script in nagios2 that has
errors in the tests that make it ignore the --with-mail option (and
build the config files with /bin/mail as a default).
This is fixed in the "configure" used in nagios3, and I backported the
fixes for nagios2. The patch also changes the cfg-commands.cfg.diff file
accordingly so that it doesn't break with the new mail command value.
Please see attached patch.
Regards,
--
Thierry (koon)
diff -u nagios2-2.11/debian/cfg-commands.cfg.diff nagios2-2.11/debian/cfg-commands.cfg.diff
--- nagios2-2.11/debian/cfg-commands.cfg.diff
+++ nagios2-2.11/debian/cfg-commands.cfg.diff
@@ -180,8 +180,8 @@
# 'host-notify-by-email' command definition
define command{
command_name host-notify-by-email
-- command_line /usr/bin/printf "%b" "***** Nagios 2.11 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
-+ command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
+- command_line /usr/bin/printf "%b" "***** Nagios 2.11 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
++ command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}
@@ -189,8 +189,8 @@
# 'notify-by-email' command definition
define command{
command_name notify-by-email
-- command_line /usr/bin/printf "%b" "***** Nagios 2.11 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
-+ 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$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
+- command_line /usr/bin/printf "%b" "***** Nagios 2.11 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
++ 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$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
diff -u nagios2-2.11/debian/patches/00list nagios2-2.11/debian/patches/00list
--- nagios2-2.11/debian/patches/00list
+++ nagios2-2.11/debian/patches/00list
@@ -2,0 +3 @@
+30_configure_with_mail_fix.dpatch
only in patch2:
unchanged:
--- nagios2-2.11.orig/debian/patches/30_configure_with_mail_fix.dpatch
+++ nagios2-2.11/debian/patches/30_configure_with_mail_fix.dpatch
@@ -0,0 +1,28 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30_configure_with_mail_fix.dpatch by Thierry Carrez <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
[EMAIL PROTECTED]@
+diff -urNad nagios2-2.11~/configure nagios2-2.11/configure
+--- nagios2-2.11~/configure 2008-03-12 15:01:03.000000000 +0100
++++ nagios2-2.11/configure 2008-06-12 14:57:15.000000000 +0200
+@@ -4866,7 +4866,7 @@
+ else
+ MAIL_PROG=no
+ fi;
+-if test MAIL_PROG=no; then
++if test x$MAIL_PROG = xno; then
+ # Extract the first word of "mail", so it can be a program name with args.
+ set dummy mail; ac_word=$2
+ echo "$as_me:$LINENO: checking for $ac_word" >&5
+@@ -4907,7 +4907,7 @@
+ fi
+
+ fi
+-if test x$MAIL_PROG=x; then
++if test x$MAIL_PROG = x; then
+ MAIL_PROG="/bin/mail"
+ fi
+