Unable to send out eail notifications

Hi,

As above, I noticed from my log file that my Nagios is monitoring my test machine however I did receive email when close down my test machine on purpose.

==================
[1139977532] HOST ALERT: ncs-shawn;DOWN;SOFT;1;CRITICAL - Host Unreachable (172.16.28.21)
[1139977535] HOST ALERT: ncs-shawn;DOWN;SOFT;2;CRITICAL - Host Unreachable (172.16.28.21)
[1139977538] HOST ALERT: ncs-shawn;DOWN;SOFT;3;CRITICAL - Host Unreachable (172.16.28.21)
[1139977541] HOST ALERT: ncs-shawn;DOWN;SOFT;4;CRITICAL - Host Unreachable (172.16.28.21)
[1139977544] HOST ALERT: ncs-shawn;DOWN;SOFT;5;CRITICAL - Host Unreachable (172.16.28.21)
[1139977547] HOST ALERT: ncs-shawn;DOWN;SOFT;6;CRITICAL - Host Unreachable (172.16.28.21)
[1139977550] HOST ALERT: ncs-shawn;DOWN;SOFT;7;CRITICAL - Host Unreachable (172.16.28.21)
[1139977554] HOST ALERT: ncs-shawn;DOWN;SOFT;8;CRITICAL - Host Unreachable (172.16.28.21)
[1139977557] HOST ALERT: ncs-shawn;DOWN;SOFT;9;CRITICAL - Host Unreachable (172.16.28.21)
[1139977560] HOST ALERT: ncs-shawn;DOWN;HARD;10;CRITICAL - Host Unreachable (172.16.28.21)
[1139977560] HOST NOTIFICATION: sxxx;ncs-shawn;DOWN;host-notify-by-epager;CRITICAL - Host Unreachable (172.16.28.21)
[1139977564] HOST NOTIFICATION: sxxx;ncs-shawn;DOWN;host-notify-by-email;CRITICAL - Host Unreachable (172.16.28.21)
[1139977564] HOST NOTIFICATION: pxxx;ncs-shawn;DOWN;host-notify-by-epager;CRITICAL - Host Unreachable (172.16.28.21)
[1139977565] HOST NOTIFICATION: pxxx;ncs-shawn;DOWN;host-notify-by-email;CRITICAL - Host Unreachable (172.16.28.21)
[1139977565] HOST NOTIFICATION: mxxx;ncs-shawn;DOWN;host-notify-by-epager;CRITICAL - Host Unreachable (172.16.28.21)
[1139977565] HOST NOTIFICATION: mxxx;ncs-shawn;DOWN;host-notify-by-email;CRITICAL - Host Unreachable (172.16.28.21)

From the log file, Nagios is actually trying to send notifications to 3 parties however all the 3 relevant parties did not receive the notifications. What could have went wrong? (Apart from invalid email address and internet connection?) Any suggestions?

check the mail command you are actually using (it should be in misccommands.cfg ) and try running it by hand.
See if the email arrives correctly or if you get any ohter form of error. (check the email logs)

Mail problems could be almost anywhere…

Let us know what the error is (if there is a clearly stated one)

Luca

Thanks Luca… :slight_smile: will take a look and check it out again!

Have you at all modified your host-notify-by-email command?

I think using epagers can be tricky. In the U.S., though, there’s a workaround to sending SMS notifications, as most every cell phone has its own e-mail address that you can configure Nagios to send mail to.

[quote=“SonOfThunder”]Have you at all modified your host-notify-by-email command?

I think using epagers can be tricky. In the U.S., though, there’s a workaround to sending SMS notifications, as most every cell phone has its own e-mail address that you can configure Nagios to send mail to.[/quote]

Not that I know of…probably I will remove the epager thingy…let me check the host-notify-by-email command…thanks for the suggestion :slight_smile:

Hey guys do it think that it is possible that I have not configure my sendmail in FC4 that have cause this problem? (Anyway my sendmail is not configured and I’m looking into it)

I don’t think my misccommand is giving me the problem since I have never done any modification on the file

Misccommand.cfg

################################################################################

Sample object config file for Nagios

Read the documentation for more information on this configuration file. I’ve

provided some comments here, but things may not be so clear without further

explanation, so make sure to read the HTML documentation!

Last Modified: 05-27-2002

################################################################################

################################################################################

COMMAND DEFINITIONS

SYNTAX:

define command{

template

name

command_name

command_line

}

WHERE:

= object name of another command definition that should be

used as a template for this definition (optional)

= object name of command definition, referenced by other

command definitions that use it as a template (optional)

= name of the command, as recognized/used by Nagios

= command line

################################################################################

################################################################################

SAMPLE NOTIFICATION COMMANDS

These are some example notification commands. They may or may not work on

your system without modification.

################################################################################

‘notify-by-email’ command definition

define command{
command_name notify-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: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /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: $OUTPUT$\nDate: $DATETIME$” | /bin/mail -s “$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$” $CONTACTPAGER$
}

‘host-notify-by-email’ command definition

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\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: $OUTPUT$\nTime: $DATETIME$” | /bin/mail -s “$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$” $CONTACTPAGER$
}

Then try running the mail command by hand to send yourself an email to a valid addy. If it’s not working, you will know it has nothing to do with nagios, and everything to do with sendmail.
For example, we recently switched our network around here and the new dns server’s have no MX record to point to the correct Microsoft exchange server. The MX record is actually still pointing to a non-existant machine.
So, I had to configure sendmail to use a particular email server by adding “mailhost” in the config file and then editting /etc/hosts and added xx.xx.xx.xx mailhost
to it.

i.e. Edit /etc/mail/sendmail.mc
make sure it says
define(SMART_HOST',mailhost’)
exit vi
now run
make -C /etc/mail
to recompile sendmail configs.
now edit /etc/hosts and put the ip addy of your mail server.
Edited Thu Feb 16 2006, 07:39PM ]