Solved

Nagios email notifications

Posted on 2011-09-06
17
1,132 Views
Last Modified: 2012-08-13
Hello EE,

I have setup and got working nagios running on Ubuntu 11.04 server.  I have 10 servers reporting to nagios.  my problem is i cant seem to find an entire answer for how to setup email notifications.  Our domain has a SMTP server up and running correctly.  we use it for our scan to email production.  I have send mail installed on Ubuntu.  I am asking for a link or a complete explanation on how to make send mail send me notifications via our Relay/SMTP server.  I have successfully done the telnet on port 25 bit and it responds correctly.  I have read and read but have not been able to figure out the rest of the pie.  Any help is appreciated, THanks!
0
Comment
Question by:12string
  • 10
  • 7
17 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36492796
Assumption:
1. Your domain SMTP server is mail.domain.com with domain domain.com
2. Your Ubuntu hostname is ubuntu11

To setup SMART_HOST on Sendmail
1. Take out localhost.localdomain in /etc/hosts
sudo    gedit   /etc/hosts
 and make sure
127.0.0.1   ubunut11.domain.com  ubuntu11  (no localhost.localdomain  for the local loop IP)

2. Add the following line into /etc/mail/sendmail.mc
define(`SMART_HOST', `mail.domain.com')dnl
    Be aware that there are both back tick (`) and single quote (').
Then
sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf"

3. Configure your SMTP server, mail.domain.com to allow open relay for ubuntu11
0
 

Author Comment

by:12string
ID: 36497129
Thanks Wesly!  i tried your response and was not able to make it work.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36497328
Which part doesn't work?
Did you setup open relay on your mail server for your Ubuntu box?
Any error message in /var/log/mail.log?
Simply " not able to make it work" will not make you get the answer quicker.
Please provide more details with error messages so experts here can help you to resolve the issue quicker.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:12string
ID: 36497356
part three i did not know how to do.  i did not set that server up and know very little about it other than we point our scan to email request to it.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36497436
Your original request is "make send mail send me notifications via our Relay/SMTP server."
Then there is requirement on the SMTP relay server to be open relay for your Ubuntu server.
Otherwise it will reject any email relay from Ubuntu server no matter how you configure your Ubuntu.
The issue is on your SMTP server side, not on Ubuntu box.
0
 

Author Comment

by:12string
ID: 36497536
agreed but where does one make changes to SMTP server to accept request from certain or IP or some computer name.  I usually just point end devices to that server and SMTP just forwards the emails on with any config on the SMTP server.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36497573
OK, please
1. On Ubuntu, send out an email to your internal and external email server
echo test | mail -s "test"  <your internal email address>
echo test | mail -s "test"  <your external email address>
  to see which one you can receive the email (or both fail)

2. check /var/log/mail.log and post any clue (base on time stamp and email address you just sent)
and post the error message here.
0
 

Author Comment

by:12string
ID: 36498384
ok this is what I get for mail and the other for sendmail:

The program 'mail' can be found in the following packages:
 * heirloom-mailx
 * mailutils
Try: sudo apt-get install <selected package>

and then for sendmail:

echo test | sendmail -s "test" some.emailaddr@domain.com
WARNING: RunAsUser for MSP ignored, check group ids (egid=1000, want=120)
can not chdir(/var/spool/mqueue-client/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.
0
 

Author Comment

by:12string
ID: 36498497
I can do telnet to smtp server on port 25 and send email using "mail" "rcpt" "data" so sendmail is working
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36498818
Please do
ls  -ald  /var/spool/mqueue-client
id

  and post result here
0
 

Author Comment

by:12string
ID: 36498850
ls -ald /var/spool/mqueue-client
drwxrws--- 2 smmsp smmsp 4096 2011-01-10 14:48 /var/spool/mqueue-client
user01@Ubuntu11:/usr/local$ id
uid=1000(user01) gid=1000(user01) groups=1000(user01),4(adm),20(dialout),24(cdrom),46(plugdev),108(sambashare),113(lpadmin),114(admin)

0
 

Author Comment

by:12string
ID: 36498855
have to go will be back in hour
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36498882
Install mailutils
sudo apt-get install mailutils
and post the result of the following command:
ls -l /usr/bin/mail
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36498942
after install mailutils, try
echo test | mail -s "test" some.emailaddr@domain.com
0
 

Author Comment

by:12string
ID: 36500246
I will try it Thanks!

after some thinking I pulled a noobie.  when I said "I can do telnet to smtp server on port 25 and send email using "mail" "rcpt" "data" so sendmail is working".  When I am telnet-ting to the SMTP server i 'm on the SMTP executing commands on the SMTP server, I am not using the sendmail or any part of the ubuntu server, what a newbie!

 i will try your responses and get back
0
 

Author Comment

by:12string
ID: 36500255
Install mailutils
sudo apt-get install mailutils
and post the result of the following command:
ls -l /usr/bin/mail

response
lrwxrwxrwx 1 root root 22 2011-09-07 19:58 /usr/bin/mail -> /etc/alternatives/mail
0
 

Author Closing Comment

by:12string
ID: 36500287
so looking back it looks like for my configuration it needs sendmail and mailutils.  Thanks Wesly for your patient help!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is my first article on Expert Exchange on the Manual Method of Exporting Office 365 Mailboxes to PST format by using the eDiscovery mechanism of Office. Hope you will enjoy the article.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question