oS 10.3: Using a mail-relay

At the moment I am working on openSUSE 10.3 box to get Nagios running.

Now I am done with my first very basic Nagios configuration which means that I passed the Nagios configurationtest without any warnings or errors.

Now I need to know, how I can use a mail-relay from my Linux-box.
The box is placed in a DMZ and has an IP of 192.168.0.5. The IP 192.168.0.4 holds a machine where a mailrelay is running that would accept mails from 192.168.0.5. Now my problem is that I do not have any idea what to do. Probably I need postfix or anything to forward?

Can someone help me please?
The idea is that Nagios is able to send mails by using the mailx-command and those mails should be forwarded to 192.168.0.4 which will manage the ongoing transport of the mail.

Thanks in advance!

You don’t need postfix for this. mailx can talk directly to a SMTP server if you set the smtp variable in the config file ~/.mailrc. See man mailx for the details.

Solved

Thanks a lot!

.mailrc:

set smtp=192.168.0.4
set from=please@no.mail

Works fine for me :slight_smile:

The only thing I had to do is to put please@no.mail on the white list of the relay-server.

So thanks again for solving this issue :slight_smile:

Sorry, I have to come back on this topic :slight_smile:

I tried to send mails via shell-command mailx/mail as root which works fine. But my nagios-installation does not send any mails.

I think I know that the reason is that the user nagios does not use root’s .mailrc. So what I did was to generate a home-dir for nagios (/home/nagios) where I stored the same file as I did it for root. But this seems not work.

FOOBAR:~ # ls -al /home/nagios/
total 12
...
-rw-r--r-- 1 nagios nagios   45 Oct 30 16:52 .mailrc

When I tried a su nagios, it does not work. I did not get an error, but the user is not switched:

Have a lot of fun...
FOOBAR:~ # su nagios
FOOBAR:~ # whoami
root
FOOBAR:~ #

So what is the trick to get the configuration that is stored in the .mailrc working for the nagios-user=?

Have a look here on some pointers on Nagios setup with openSUSE (based on openSUSE 11.0):
Installing Nagios on openSUSE 11.0

Much of the configuration is already there… you only need to setup some extra packages and set some settings through YaST.

Cheers,
Wj

Thanks - helped me lot :slight_smile:
Nagios is now working and able to drop mails :slight_smile:

Glad to hear it :wink:

Cheers,
Wj