LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 10-22-2009, 04:47 AM   #1
fabbie
LQ Newbie
 
Registered: Oct 2009
Posts: 22

Rep: Reputation: 0
Nagios email notification unable to work with Nail Mail


Hi guys,
I'm Fabian. Just started using Linux recently, and been banging my head real hard for the past few weeks.

I've gotten myself involved in the Nagios monitoring tools and somewhat managed to configure the Nagios host, but I'm still having some issues with the email notifications.
From what I've read/researched, one of the favourite methods to get the email notification up is by using sendmail/postfix. I've went through it and learned that they are MTAs. What I actually needed is just a basic email client, and I would email the notices directly to an email address over the internet. Thus, I wont be needing something as complex like sendmail/postfix.

I gotten my hands on "Nail mail". I've successfully configured it to be able to send emails from my linux machine over the internet. However, when I copied the same command lines to nagios's contact.cfg, it did not work.

This is the command line that I'm using. Let me explain what I'm trying to achieve below. Firstly, I would save all the text notifications into a text file(green), and then email it out. The problem is NailMail command (red) does not work on Nagios,but the command line works in the terminal command on my Nagios account. Any ideas why? Has anyone attempted using Nail mail with Nagios?
I would appreciate any kind of help.Thanks.

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" > /home/nagios/notification | /usr/bin/nail -A tw -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ < /home/nagios/notification
 
Old 10-22-2009, 10:03 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by fabbie View Post
Hi guys,
I'm Fabian. Just started using Linux recently, and been banging my head real hard for the past few weeks.

I've gotten myself involved in the Nagios monitoring tools and somewhat managed to configure the Nagios host, but I'm still having some issues with the email notifications.
From what I've read/researched, one of the favourite methods to get the email notification up is by using sendmail/postfix. I've went through it and learned that they are MTAs. What I actually needed is just a basic email client, and I would email the notices directly to an email address over the internet. Thus, I wont be needing something as complex like sendmail/postfix.

I gotten my hands on "Nail mail". I've successfully configured it to be able to send emails from my linux machine over the internet. However, when I copied the same command lines to nagios's contact.cfg, it did not work.

This is the command line that I'm using. Let me explain what I'm trying to achieve below. Firstly, I would save all the text notifications into a text file(green), and then email it out. The problem is NailMail command (red) does not work on Nagios,but the command line works in the terminal command on my Nagios account. Any ideas why? Has anyone attempted using Nail mail with Nagios?
I would appreciate any kind of help.Thanks.

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" > /home/nagios/notification | /usr/bin/nail -A tw -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ < /home/nagios/notification


i just set up my notifications to use nail.
works fine, but i will say, it is acting just like mail does, and using sendmail to relay the mail via localhost.
how are you relaying your mail??
 
Old 10-22-2009, 09:31 PM   #3
fabbie
LQ Newbie
 
Registered: Oct 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Thanks for the reply CentosBoy.

Actually, I'm not using sendmail at all. At this moment, I still do not have any idea how to configure my sendmail yet. That's the reason why i resorted to using heirloom mailx. Feel free to ask me more questions to get me thinking at different angles. Im still new at this. I may be missing some stuff.

Basically, i found that it's easy to configure it as an email client without the need of postfix/sendmail.
http://heirloom.sourceforge.net/mailx/mailx.1.html

All I needed to do was to set up my account in .mailrc
Eg.
account companydomain {
set verbose
set smtp=mail.companydomain.com:yyy
set from=myemailaddr.companydomain.com
set smtp-auth=login
set smtp-auth-user=myemailaddr.companydomain.com
set smtp-auth-password=zzz
}

After that, I executed
/usr/bin/nail -A companydomain -s "test" myemailaddr.companydomain.com < emailbody.txt

Resolving host xxx.companydomain.com . . . done.
Connecting to ddd.ddd.ddd.ddd . . . connected.
220 companydomain.com ESMTP
>>> EHLO localhost.
localdomain
250-companydomain.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-STARTTLS
250-PIPELINING
250 8BITMIME
>>> AUTH LOGIN
334 VXNlcm5hbWU6
>>> Zi50YW5AdHJpbml0eXdpemFyZHMuY29t
334 UGFzc3dvcmQ6
>>> ZmFiNTk2Mw==
235 ok, go ahead (#2.0.0)
>>> MAIL FROM:<myemailaddr@companydomain.com>
250 ok
>>> RCPT TO:<myemailaddr@companydomain.com>
250 ok
>>> DATA
354 go ahead
>>> .
250 ok 1256260815 qp 2955
>>> QUIT
221 companydomain.com

And then, I received the email.(Basically im sending an email to myself through the internet for testing purpose)

My main concern now is, I could sent out emails by typing "/usr/bin/nail -A companydomain -s "test" myemailaddr.companydomain.com < emailbody.txt" into the terminal command. But, it does not work when i use this method in Nagios's command.cfg notify-by-email command line.

Thanks. Appreciate any comments.
 
Old 10-22-2009, 11:01 PM   #4
fabbie
LQ Newbie
 
Registered: Oct 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Finally got it working.
Your comment got me thinking more on the MTA and SMTPs.

Configured my postfix to a relayhost, and got it working. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios Email Notification Assistance deibertine Linux - Newbie 7 10-05-2012 12:19 PM
E-mail notification with Nagios Hiroyatamoto Linux - Newbie 7 06-30-2009 11:18 AM
Nagios E-mail notification Hiroyatamoto Linux - General 5 07-02-2008 03:55 AM
Nagios E-mail notification setup Hiroyatamoto Linux - Newbie 3 07-01-2008 04:30 PM


All times are GMT -5. The time now is 11:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration