LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2008, 11:52 AM   #1
Hiroyatamoto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Rep: Reputation: 0
Talking E-mail notification with Nagios


I have installed Nagios on Ubuntu (according to the quick start guide) and it is currently monitoring the localhost, a router, and a Windows box (using NSClient++). Using the web interface, I am able to monitor all of this (under Service Details) and it all works fine. I need to know how to set up e-mail notification so that I may get the alerts in my e-mail (gmail). Any real help would be much appreciated.
 
Old 06-26-2008, 06:41 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Which version? 2 or 3? In version2 check the contacts and contactgroups configs.
 
Old 06-26-2008, 10:08 PM   #3
Hiroyatamoto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by unSpawn View Post
Which version? 2 or 3? In version2 check the contacts and contactgroups configs.
It's version 3...
I have installed mailx and also installed sendmail and also changed the commands.cfg to “/usr/bin/mail” from just “/bin/mail”. I am not sure if it’s a nagios issue (almost sure that it’s not) but I really don’t know how to check sendmail to determine if it’s actually working properly.
 
Old 06-27-2008, 04:06 AM   #4
pansarevaibhav
Member
 
Registered: Oct 2005
Location: mumbai
Posts: 34

Rep: Reputation: 15
Quote:
Originally Posted by Hiroyatamoto View Post
It's version 3...
I have installed mailx and also installed sendmail and also changed the commands.cfg to “/usr/bin/mail” from just “/bin/mail”. I am not sure if it’s a nagios issue (almost sure that it’s not) but I really don’t know how to check sendmail to determine if it’s actually working properly.
Hi,

I think you put the details in contact and contact group. If so then check ur mail service is running? check if mails are in queue and most important check the logs of mail service. I have done this configuration in nogios + postfix combination..there also I got sometime same problem due to postfix was stop.
I think for such small configuration postfix is rather easy solution.
One more thing if you have mail server at your end then it need not require to set mail server at nagios.
 
Old 06-27-2008, 12:15 PM   #5
Hiroyatamoto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by pansarevaibhav View Post
Hi,

I think you put the details in contact and contact group. If so then check ur mail service is running? check if mails are in queue and most important check the logs of mail service. I have done this configuration in nogios + postfix combination..there also I got sometime same problem due to postfix was stop.
I think for such small configuration postfix is rather easy solution.
One more thing if you have mail server at your end then it need not require to set mail server at nagios.
Thanks much!
I will try using Postfix instead (hopefully it will work).
 
Old 07-02-2008, 01:17 PM   #6
netmaster3620
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Rep: Reputation: 0
Same Problem

I am having the same problem with Nagios and Ubuntu. I am trying to get E-Mail notifications working in Nagios as well. I have configured Nagios to monitor 20 hosts and over 60 services. I am running Nagios on Ubuntu 7.10 and I am extremly impressed with the flexibility of the system.

The problem is that I cannot for the life of me get E-Mail notifications working. I have the following configurations.

Service Configuration
Quote:
define service{
use generic-service
host_name bbtsbcc
service_description C-Card Gateway
check_command check_bbtsbcc_credit-card-gateway
contacts jarm
notification_period 24x7
notification_options w,c,r
}
Contact Definition
Quote:
define contact{
contact_name jarm
use generic-contact
alias Jim A
host_notifications_enabled 1
service_notifications_enabled 1
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email email@address.com
can_submit_commands 1
}
Command Definitions
Quote:
define command{
command_name 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" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

define command{
command_name 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$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
I have installed mailx and followed the Ubuntu Quickstart Guide. I found some instructions on another thread that reccomended that I change the permissions on the /usr/local/nagios/var/rw/nagios.cmd file to 775. This did not make a difference.

To further troubleshoot the issue I looked at the nagios.log file and noticed the following message that I thought was relevant,

Quote:
[1215020779] SERVICE NOTIFICATION: nagiosadmin;host1;T.I.A.;CRITICAL;notify-service-by-email;Connection refused
[1215020781] SERVICE NOTIFICATION: jarm;host1;T.I.A.;CRITICAL;notify-service-by-email;Connection refused
Any Ideas...
 
Old 07-02-2008, 03:02 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by netmaster3620 View Post
Any Ideas...
Wrt your "connection refused", how about testing delivery to that address manually using your favourite MUA or telnet or netcat?
 
Old 06-30-2009, 11:18 AM   #8
mbritojr
LQ Newbie
 
Registered: Jun 2005
Posts: 7

Rep: Reputation: 0
Exclamation

I discovered this post after having the same problem.

I configured NAGIOS on a Fedora 10 server.

First I discovered that my DNS was not configured correctly on my linux box. I used the following commands to configure my hostname, DNS servers and DNS search domain:

system-network-config-tui
hostname
nano /etc/hosts

Second I realized that there was no MX record in my domain for my mail server, it's an Exchange server that everyone accesses via OWA and an external mail scrubbing service is used so the lack of internal MX was never picked up.

After I corrected the DNS issue and created the MX record for my mail server the NAGIOS notifications started flowing like the salmon of Capistrano. ;-)

In case that doesn't work for you, install ALPINE and try to send some test emails:

yum -y install alpine

I hope this helps you and anyone else who is trying to configure NAGIOS notifications.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NAGIOS notification ny101880 Linux - Newbie 14 01-04-2009 01:10 AM
Nagios E-mail notification setup Hiroyatamoto Linux - Newbie 3 07-01-2008 04:30 PM
Gnome Mail Notification - POP3 mail always shown as new? tsiMental Linux - Software 0 09-08-2005 10:50 AM
E-Mail notification to users via SMS (gateway script ok, but notification script?!?) Riku2015 Linux - Networking 10 03-08-2002 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration