Page 1 of 1

No notifications

Posted: Thu Mar 31, 2011 10:04 am
by cwscribner
Recently did a fresh download of Nagios XI (virtual disk) and loaded it into VMWare Server 2. Its doing some really odd/infuriating things.

Problems:
No Email notifications
No Text notifications
Hangs up when sending test emails/texts

I literally have everything enabled and configured correctly. I've tried email notifications through Sendmail and SMTP (using Gmail servers). I managed to get a single test email via Sendmail that took 45 minutes to get to me. Now I'm getting nothing at all.

Re: No notifications

Posted: Thu Mar 31, 2011 3:31 pm
by rdedon
Hello,
are you using the most recent from here:
http://library.nagios.com/library/produ ... loads/main

Re: No notifications

Posted: Wed Apr 06, 2011 12:03 pm
by niebais
Can you send an email via sendmail on the command line?

What I've found with Nagios is it rarely is the reason why email doesn't make it to your account. Usually somebody messes up sendmail or they mess up the email server.

Here's an example command for sendmail:
http://www.noah.org/wiki/Sendmail_to_send_mail

Also, here's a perl subroutine you can use to try sending through an smtp server example to send manually:
sub sendEmail {
my $from = shift;
my $to = shift;
my $subject = shift;
my $msg = shift;

my $date = localtime();
$date = ParseDate($date);
$date = UnixDate($date,"%A, %B %E at %H:%M:%S");

my $email = "MIME-Version: 1.0\n"
. "From: $from\n"
. "To: " . ( ref($to) ? join(';', @$to) : $to ) . "\n"
. "Date: " . $date . "\n"
. "Content-Type: text/html \n"
. "Subject: $subject\n\n" # Double \n
. $msg;

#print qq|Sending from $from, To: $to, Message: $msg\n|;

my $SMTP_HOST = '{YOURSMTPHOSTGOESHERE}';
#
# Open a SMTP session
#
my $smtp = Net::SMTP->new( $SMTP_HOST,
'Debug' => 0, # Change to a 1 to turn on debug messages
Hello => '{YOURHELLODOMAINGOESHERE}',
);

if(!defined($smtp) || !($smtp)) {
print "SMTP ERROR: Unable to open smtp session.\n";
return 0;
}

#
# Pass the 'from' email address, exit if error
#
if (! ($smtp->mail( $from ) ) ) {
return 0;
}

#
# Pass the recipient address(es)
#
if (! ($smtp->recipient( ( ref($to) ? @$to : $to ) ) ) ) {
return 0;
}

#
# Send the message
#
$smtp->data( $email );

$smtp->quit;
}

To call the command use this:
sendEmail($from_email,$to_email, $subject, $body_text);

When you send the messages, tail the logs /var/log/maillog and lets see what happens.

Email can be a really tricky thing.

Re: No notifications

Posted: Wed Apr 06, 2011 12:41 pm
by rdedon
Thank you niebias for posting that, cwscribner , if you still are having issues please post again and we will be glad to continue assisting you.