Nagios Notifications

Hello All,

 I accidentally erased the other 2 paragraphs I had written here so. This one will be much shorter now I suppose (I'm staying away from the refresh button... :( )

I have SLES 11 (64bit) installed and fully functional. I have Nagios installed and humming along nicely. Fully configured except for notifications.

Server has postfix installed. I didn’t set it up or install it. Not sure how it got there but since it’s not configured, I need help with that. I need it to simply point to our GroupWise server and pass the messages from a fake email and have it get to my real internal email address when something bad happens in nagios. I know this is possible through our GroupWise server since I have pointed copiers to it before and given them a fake address such as ‘copier@domain.therest’ and it works perfect when needing to send an email via SMTP unauthenticated. So I clearly needed to set up postfix to work with our GroupWise the same way those devices to. I thought to myself "Easy! Just set up postfix so this box can send out emails. Point this postfix at the SMTP (GroupWise) server. And it will bounce off of it internally no problem. HA!

Tried setting it up from this guide. All went fine. Then ran rcpostfix restart. Tested it with a simple mailx command. mailx myemail@domain.therest and typed it out. Ended it and it says it sent with no errors on the screen. Checked the /var/log/mail. The following is in there.

Nov 21 13:02:08 nagios postfix/pickup[6665]: 58906E2D2: uid=0 from=<root>
Nov 21 13:02:08 nagios postfix/cleanup[22896]: 58906E2D2: message-id=<20121121180208.58906E2D2@nagios.domain.therest>
Nov 21 13:02:08 nagios postfix/qmgr[17553]: 58906E2D2: from=<root@domain.therest>, size=380, nrcpt=1 (queue active)
Nov 21 13:02:08 nagios postfix/local[23220]: 58906E2D2: to=<myemail@domain.therest>, relay=local, delay=0.05, delays=0.04/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "myemail")
Nov 21 13:02:08 nagios postfix/cleanup[22896]: 5EA1DE2D3: message-id=<20121121180208.5EA1DE2D3@nagios.domain.therest>
Nov 21 13:02:08 nagios postfix/cleanup[22896]: warning: 5EA1DE2D3: queue file size limit exceeded
Nov 21 13:02:08 nagios postfix/qmgr[17553]: 58906E2D2: status=deferred (bounce failed)

So I said to myself. Well duh! I need to send it to the user that is created for nagios! The “admin” account. In /etc/nagios/objects/contacts.cfg, the user ‘admin’ is defined and then my email address is associated there. So I tried the command mailx admin blah blah .. No change. No error message in the term windows but in the logs, same errors. So. I then said. Well. Clearly I need to have this server pointing to the SMTP server that I want right? Since this is trying to send these out, it needs something to send them through. So I put in this command postconf -e 'relayhost = 10.50.X.X'. Tried again. No change. Still stating that user doesn’t exist. Clearly I’m missing something since I don’t want this darn thing to send it to a “user”, I want this thing to send whatever messages need to be sent out in just a general email format and have the GroupWise server pass it on! I know it can be done. I’ve seen it done!!

So I’m missing something. Any help would be wonderful guys! I can post some copies of my /etc/postfix/main.cf if needed. I can also post the output from ‘postconf’ if needed. Thanks guys!

Mitch

Hi
Have you checked the main.cf file to ensure the relay host/domains are
set?

I would also look at using YaST to configure the settings rather than
the command line.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.11-2.16-desktop
up 1 day 2:18, 5 users, load average: 0.13, 0.13, 0.39
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

[QUOTE=malcolmlewis;10283]Hi
Have you checked the main.cf file to ensure the relay host/domains are
set?[/QUOTE]

Yeah I have those set. :expressionless:

I will look at using Yast Right now. :S I’m just not very familiar with it that way. I’m better at pointing it to what I want it to do and thats it. I don’t want to leave any security vulnerabilities because it has to be “set up the way yast wants it”. Meh Guess I’m fuddy like that. Worst that happens is it doesn’t work that way right? :slight_smile:

Hi
If you use YaST and there is an update it shouldn’t overwrite your
config (/etc/sysconfig/postfix). Modifying the actual files could lead
to your configs being over written on an update.

The other thing I normally do is use the aliases file to add/associate
email addresses.

If you just work as a user to get it to relay your email, then things
should work with a mail alias.

So all you should have to do is this;
http://www.postfix.org/STANDARD_CONFIGURATION_README.html#local_network


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.11-2.16-desktop
up 2 days 14:42, 4 users, load average: 0.10, 0.04, 0.07
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

Uh I am not sure I followed you on the last part and. I couldn’t get the mail server via Yast to finish properly. :expressionless: I’m muckin this up…

We already have a full LDAP server in place. We have a full email server in place. I simply want to point my nagios box to the mail server and say “email my message”. :frowning:

OK! I have gotten slightly closer to what I want to do but no better on how to do it!?

I have used the command

 telnet 10.50.x.x 25 

then it says “mail.FQDN.site Ready”

I used the HELO and it says “OK”

So I said (please note here… FQDN.site is our domain name and our email. It works flawlessly.)

 MAIL FROM: mbumgarner@FQDN.site 

Got a return of “250 OK.”

 RCPT TO: mbumgarner@FQDN.site 

Return 250 OK.

[CODE] DATA
Hello

Does this message send from within the telnet? It should!

.
[/CODE]
Return of “250 OK”

I immediately received the email. So! No auth. No nothing needed. So that’s what I want nagios to do. Simply SMTP into that server. Send the same amount of data but in nagios format. Then be done. Shouldn’t be as hard as I’m making it…

Thanks!

Hi Mitch,

Postfix comes “preconfigured” for local mail delivery and can be customized to utilize a “master mail server” via /etc/sysconfig/postfix. The variables to look out for are:

POSTFIX_RELAYHOST=“10.50.X.X” # set this to your actual mail server
POSTFIX_NULLCLIENT=“yes” # set this to “yes” to hand all mail to the relay host

Running “SuSEconfig --module postfix” will update the configuration files accordingly.

Oh, and please note that actually all mail originating on your server is sent to your central machine… including mail for root.

Now as you’ve already have manually modified Postfix’s configuration, you may have to clean that up for the above to work.

[Edit]: As an alternative, you might be able to configure your Nagios instance to use a separate SMTP server, rather than sending it to localhost - that way you’d avoid messing with the local Postfix configuration.

Regards,
Jens