unable to send mail to external id

Paul Weaver paul.weaver at bbc.co.uk
Wed Feb 11 14:01:22 CET 2009


> Dear Sir,
> I have configure my nagios in Linux and I am getting email
notification in my local mail id but I didn't
> get mail to my external id(Gmail or yahoo) . can you please help.

Nagios sounds like it is configured fine, it sounds like your local
machine isn't configured to send emails though - nagios uses the native
linux way of sending emails, which often isn't configured.

Try the following:

# echo "Test from nagios"|mail -s Test root
# echo "Test from nagios"|mail -s Test user at yourcompany.com
# echo "Test from nagios"|mail -s Test user at gmail.com

That should send three emails. I would guess the first one works. If the
others don't work, you need to set up your mail transfer agent (exim,
sendmail etc) to point to a "smarthost", your companies internal smtp
gateway.

Alternativly, you could do the following

1) Change your command definition 
define command{
	command_name	notify-by-email
	command_line      *******
}

Replace the end of the line, which probably says something like
| /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$

With
| $USER1$/sendEmail.pl $CONTACTEMAIL$ "** $NOTIFICATIONTYPE$ alert -
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" 

E.G. (this only works for nagios 2.9)
	/usr/bin/printf "%b" "***** Nagios 2.9 *****\n\nNotification
Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" |
$USER1$/sendEmail.pl $CONTACTEMAIL$ "** $NOTIFICATIONTYPE$ alert -
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" 


2) Add "sendEmail.pl" (http://195.50.87.86/~npf/sendEmail.pl) to your
libexec directory, and change the "mailServer" and "from" to be valid
for your local network.



--

"Experience is what you get when you were expecting something else."

Paul Weaver    
Systems Development Engineer
News Production Facilities, BBC News

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list