Link to home
Start Free TrialLog in
Avatar of Bigflicks
Bigflicks

asked on

mail from redhat linux

I have a Redhat linux machine..
I am using nagios and trying to send mail to my external account
But does not seem to be working..

1. i need to know how would i test if my linux machine can send mail to external accounts.
2.how do i test if nagios is sending mails to external account.
3. when mail are sent where are store before they are dispatched. in linux and in nagios
4. does nagios and linux have log file created.
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

1. i need to know how would i test if my linux machine can send mail to external accounts.

cat /etc/hosts | mail -s "test" urname@gmail.com

so it wil sent /etc/hosts file to your gmail account


2.how do i test if nagios is sending mails to external account.

 cat /var/log/maillog

check entery  , it will say something like this

Jun 29 13:10:41 mail sendmail[5209]: n5TCAfgm005209: from=nagios, size=306, class=0, nrcpts=1, msgid=<200906291210.n5TCAfgm005209@mail.websolution4u.co.uk>, relay=nagios@localhost
Jun 29 13:10:41 mail sendmail[5210]: n5TCAfA9005210: from=<nagios@mail.xxx.co.uk>, size=608, class=0, nrcpts=1, msgid=<200906291210.n5TCAfgm005209@mail.xxx.co.uk>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]

From nagios


3. when mail are sent where are store before they are dispatched. in linux and in nagios

as far i know, if mail it not queued, it does not store anywhere
but if its stored for queued
use mailq command to see

4. does nagios and linux have log file created.

yes:it should be in

/var/log/messages : nagios
/var/log/maillog for sendmail
Avatar of Bigflicks
Bigflicks

ASKER

i see 1193 in mailq.
 
n5OCScKL013374      226 Wed Jun 24 17:58 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         <pramod.shetty@bigflix.com>
n5OD7SlW015023      254 Wed Jun 24 18:37 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         <pramod.shetty@bigflix.com>
n5OCr8kT014449      255 Wed Jun 24 18:23 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         pramod.shetty@bigflix.com

 
where are i can ping my smtp server..
 
how do i clear the mailq.
smtp.bigflix.com , does not received any email

if you do

telnet smtp.bigflix.com 25

it would not connect, sthat mean smtp.bigflix.com does not acceptd any email

to clear mailq

/var/spool/mqueue

just empty this directory
telnet does work...
 

[root@nagios log]# telnet smtp.bigflix.com 25
Trying 10.65.168.41...
Connected to smtp.bigflix.com (10.65.x.x).
Escape character is '^]'.
220 smtp.bigflicks.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Mon, 29 Jun 2009 18:13:40 +0530
 
what is
n5OD7SlW015023      254 Wed Jun 24 18:37 <nagios@localhost.localdomain>
                (Deferred: Connection timed out with smtp.bigflix.com.)
                                        pramod.shetty@bigflix.com
nagios@localhost.localdomain - how can i change  - is that the hostname..
Do i have to set anything here in my linux server.
like what is the smtp server . where the mails should be going.
like MTA or sendmail or any client software and how do i do that
hi, allow me 1 hr, im away of my desk
Avatar of Jan Bacher
This may be the problem:

nagios@localhost.localdomain

Forward and inverse DNS of your machine should match and sendmail should be sending emails with the correct host information.

Update forward and inverse dns (holler if you need help).



In /etc/mail/sendmail.mc:

MASQUERADE_DOMAIN(yourdomain.com)dnl


Save and exit, then:

make -C /etc/mail

and

service sendmail restart
ok  (Deferred: Connection timed out with smtp.bigflix.com.)

it  meants, sendmail unable to find host smtp.bigflix.com

now tel me someting

smtp.bigflix.com and nagaios server is this in Same network ??

because if i do telnet its showing like this

telnet smtp.bigflix.com 25
Trying 220.226.178.201...

its not showing 10.65.168.41
That what i was wondering why should it show me the public ip. though i have put the internal ip in the hosts file..
where does it pick the public ip because i rebooted the still it did not help.
The machine is in the same network
It can be possible it is reading from teh DNS
How do i disable the DNS for this mnachine..
i got the following message
[root@payment2 etc]# make -C /etc/mail
make: Entering directory `/etc/mail'
WARNING: 'sendmail.mc' is modified. Please install package sendmail-cf to update your configuration.
WARNING: 'submit.mc' is modified. Please install package sendmail-cf to update your configuration.
make: Leaving directory `/etc/mail'

is this correct.
good morning

ok so there must be a domain call smtp.bigflix.com .

so you saying, both mechine is in same network , and you can telnet to that mechine


you need to install sendmail-cf

yum install sendmail-cf

then run make command


1 question
since this is an internal mailserver

so, from nagios server, how are you definnign the username where the email will go ??

now if you try sent like this,

example


cat /etc/hosts | mail -s "test" urname@bigflix.com

it will try to deliver that email to bigflix.com which i said, it would not because bigflix.com is  a public domain and it cant received email

does it make sence?
i have modified the file

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        email                           pramod.shetty@bigflix.com       ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

how does the linux machine know which domain i need to send.. like smtp.bigflix.com- i can send to may be some other server.. mail.bigflix.com
so how i would define that..
 
[root@nagios objects]# rpm -qa "send*"
sendmail-8.13.1-3.RHEL4.5
is already installed
SOLUTION
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is the issue resolved?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
done resolved