Solved

Nagios email notifications

Posted on 2011-09-06
17
1,133 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix process listing into CSV format 3 87
php56-php-mcrypt for rhel7 php56 1 168
Understanding ping command in Ubuntu 5 64
database connection error mysql stops 7 82
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Fine Tune your automatic Updates for Ubuntu / Debian
The purpose of this video is to demonstrate how to use PicMonkey software to customize images for a Mailchimp campaign. Picmonkey is free and simple online software which can be used by users who don’t have robust editing software such as Photoshop,…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

734 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