Quote:
Originally Posted by deibertine
Yes I can send mail when sending a test in the box, no issues there. Thanks for checking!
|
UPDATE:
I verified the scripts and such then tested it once again, now getting this from my message logs:
Apr 1 16:46:16 srv nagios: HOST NOTIFICATION: user1;server.domain.com;DOWN;host-notify-by-email;PING CRITICAL - Packet loss = 100%
Apr 1 16:46:16 srv nagios: Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios 2.10 *****\n\nNotification Type: PROBLEM\nHost: server.domain.com\nState: DOWN\nAddress: 172.168.1.25\nInfo: PING CRITICAL - Packet loss = 100%\n\nDate/Time: Wed Apr 1 16:46:16 PDT 2009\n" | /bin/mail -s "Host DOWN alert for server.domain.com!"
user1@domain.com" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
I made sure that there are no quoting errors causing my problem which I checked my command definition
for host-notify-by-email.
################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################
# 'host-notify-by-email' command definition
define command{
command_name host-notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios 2.10 *****\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$
}
# 'host-notify-by-epager' command definition
define command{
command_name host-notify-by-epager
command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
}
# 'notify-by-email' command definition
define command{
command_name notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios 2.10 *****\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$
}
# 'notify-by-epager' command definition
define command{
command_name notify-by-epager
command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
}
Is there anything that you see or know that I must do/correct in the above statement? Please advise, desperately need assistance to make this work. Thanks in advance!