Would greatly appreciate some help configuring notifications

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.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: Would greatly appreciate some help configuring notificat

Post by millisa »

I'm assuming you get that message when running

Code: Select all

sudo mailq
Nope, not normal. Sounds like your local mail server (postfix in this case) isn't running. You can quickly verify by telnetting to localhost port 25.

Try stopping postfix, watching your /var/mail/mail.log and starting postfix. It usually will give you a hint why it's not running.
logic_bomb421
Posts: 43
Joined: Tue Jul 15, 2014 6:58 pm

Re: Would greatly appreciate some help configuring notificat

Post by logic_bomb421 »

Yes, I see that message when checking the mail queue.

Alright, so I did

Code: Select all

telnet localhost 25
and everything worked just fine. I got no errors. However, when I stopped postfix and started it while watching the log, I did see something interesting:

Code: Select all

*timestamp* SERVERNAME postfix/master[MISC PORT]: fatal: bind 0.0.0.0 port 25: Address already in use
Where is it getting 0.0.0.0:25 from?
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: Would greatly appreciate some help configuring notificat

Post by millisa »

Sounds like you already have something listening on port 25. Stop postfix; I expect you'll still be able to telnet to port 25.
Show what's listening:

Code: Select all

sudo netstat -tulpn
Make it just show you port 25 stuff:

Code: Select all

sudo netstat -tulpn|grep :25
The last column shows the pid/process name. If it isn't obvious which program is listening from that, you can do a

Code: Select all

sudo ls -l /proc/PutPidNumberHere/exe
and it should point you to the binary that is doing the listening.

Quick example (i'm on as root, so I'm leaving out the sudo's)

Code: Select all

[root@abc1]# netstat -tulpn|grep :25
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      27899/master        
tcp        0      0 ::1:25                      :::*                        LISTEN      27899/master        
[root@abc1]# ls -l /proc/27899/exe
lrwxrwxrwx 1 root root 0 Jul 22 13:56 /proc/27899/exe -> /usr/libexec/postfix/master
So I have postfix listening on tcp25.

I'm wagering this next doughnut that you've got sendmail running still or postfix isn't actually getting stopped.
logic_bomb421
Posts: 43
Joined: Tue Jul 15, 2014 6:58 pm

Re: Would greatly appreciate some help configuring notificat

Post by logic_bomb421 »

Alright, managed to figure out that sendmail is still listening on port 25 (it actually says 127.0.0.1:25, why does sendmail have the localhost?).

What I don't understand now, is how sendmail is still present? I did

Code: Select all

apt-get purge sendmail
before I installed postfix because I was worried about conflicts like this. Guess I didn't fully remove it?

Next question, how do I stop sendmail from listening and allow postfix to pick it up?

Thank you for all your help by the way.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: Would greatly appreciate some help configuring notificat

Post by millisa »

I'm not an ubuntu guy, but I saw a few posts where people claimed you needed to do

Code: Select all

sudo apt-get purge sendmail*
Maybe there is a startup script still lurking? For now, you could just kill the process id you found in the netstat above:

Code: Select all

kill putPIDhere
and if it still hangs around throw a -9 in there:

Code: Select all

kill -9 putPIDhere
Recheck that it's gone with the netstat, telnet, etc. Then try starting postfix again. If it looks to be working, you should probably check it on a reboot.
logic_bomb421
Posts: 43
Joined: Tue Jul 15, 2014 6:58 pm

Re: Would greatly appreciate some help configuring notificat

Post by logic_bomb421 »

Awesome! That worked! I still have to test the reboot, but at least I have something to stand on now.

I was able to get mail to come through using the command prompt. Nagios notifications still aren't showing up, but that's because I reconfigured the send command earlier. I'm going to revert back to default and see what that does.

Thank you!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Would greatly appreciate some help configuring notificat

Post by tmcdonald »

Thanks millisa, as always, for the help!

logic_bomb421, let us know how this works out for you.
Former Nagios employee
logic_bomb421
Posts: 43
Joined: Tue Jul 15, 2014 6:58 pm

Re: Would greatly appreciate some help configuring notificat

Post by logic_bomb421 »

Notifications are 5 by 5! Somehow sendmail was still clogging port 25 as speculated above. I killed the sendmail process and notifications started coming through almost instantly! I rebooted my Nagios machine and postfix was still bound to port 25.

Thank you for all your help! Even though this wasn't necessarily a Nagios issue, I still greatly appreciate you taking the time to troubleshoot this with me.
Locked