Solved

Nagios email notifications

Posted on 2011-09-06
17
1,126 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
Comment Utility
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
Comment Utility
Thanks Wesly!  i tried your response and was not able to make it work.
0
 
LVL 38

Expert Comment

by:wesly_chen
Comment Utility
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
 

Author Comment

by:12string
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:12string
Comment Utility
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
Comment Utility
Please do
ls  -ald  /var/spool/mqueue-client
id

  and post result here
0
 

Author Comment

by:12string
Comment Utility
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
Comment Utility
have to go will be back in hour
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
Comment Utility
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
Comment Utility
after install mailutils, try
echo test | mail -s "test" some.emailaddr@domain.com
0
 

Author Comment

by:12string
Comment Utility
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
Comment Utility
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
Comment Utility
so looking back it looks like for my configuration it needs sendmail and mailutils.  Thanks Wesly for your patient help!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Microsoft Outlook provides an easy way to recover permanently deleted items. When you empty the Deleted Items or simply deleted an Outlook data items using shift+Del key then it can be recovered using Registry Key settings.  Caution- Wrong Registry…
Explore the encryption capabilities built into Google Apps and how these features can help you meet privacy policy and regulatory compliance, but are not a full solution. Understand and compare the most popular email encryption services for Google A…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now