Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Nagios email notifications

Posted on 2011-09-06
17
Medium Priority
?
1,142 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Dermot
The life of crime is over for 22 year-old Christian Ian Salvador, a student from Isabela State University in the Philippines.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
This Micro Tutorial will demonstrate the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

885 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