How to change smtp server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Dr. Natas
Posts: 14
Joined: Tue Dec 11, 2012 6:39 pm

How to change smtp server

Post by Dr. Natas »

Hey everyone,
I'm having some difficulty finding where the mailexchange1 configurations is at. I'm trying to update it to mailexhange.2.example.com, but I don't know there the settings are located. Does anyone know where I can adjust the settings for the new server.

Output of /var/log/maillog

Code: Select all

Jun 28 15:00:01 nagios_localhost postfix/smtp[29778]: 0354F604D5: to=<some.one@example.com>, relay=mailexchange1.example.com [x.x.x.x]:25, delay=0.74, delays=0.24/0.02/0/0.47, dsn=2.6.0, status=sent (250 2.6.0 <20160628220001.0354F604D5@nagios_localdomain> [InternalId=1365128] Queued mail for delivery)
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How to change smtp server

Post by Box293 »

Does this guide help:
https://www.linode.com/docs/email/postf ... tp-debian7

While it's for Debian, the config should be the same.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Dr. Natas
Posts: 14
Joined: Tue Dec 11, 2012 6:39 pm

Re: How to change smtp server

Post by Dr. Natas »

Sorry for the late reply, but I'm running CentOS 6 x86_64. Here is sample output of my /etc/mail.rc I'm still trying to find my way around nagios, but still no luck.

Code: Select all

[root@nagios tmp]# cat main.cf | grep -v  -e '#' -e '^$'
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
Sample output of /etc/postfix/main.rc

Code: Select all

[root@nagios postfix]# cat main.cf |grep  -v -e '#' -e '^$'
ueue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
 
  
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: How to change smtp server

Post by tgriep »

If you want to change the relay host that postfix forwards it's email to, you would edit the main.cf file and un-comment one og the relayhost options and put your new server in it like the example below.

Code: Select all

relayhost = mailexhange.2.example.com
This would work for you is the new server doesn't require any sort of authentication.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Dr. Natas
Posts: 14
Joined: Tue Dec 11, 2012 6:39 pm

Re: How to change smtp server

Post by Dr. Natas »

Thank you,
I worked perfectly. I turned out my windows admin didn't update out mail exchange servers so I they were still using the old ones.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to change smtp server

Post by mcapra »

Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
Dr. Natas
Posts: 14
Joined: Tue Dec 11, 2012 6:39 pm

Re: How to change smtp server

Post by Dr. Natas »

Issued resolved.
Locked