Nagios XI Mail delivery

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Nagios XI Mail delivery

Post by emartine »

What is the best way to tell that nagios has failed to deliver a notification? I'm noticing that notifications are going out to folks but I am being told that they never received the alerts. Checking to ensure that their contact information was correct was the first think I am doing, pending the accuracy of that, is there a way to tell if delivery has failed to the recipients?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios XI Mail delivery

Post by tgriep »

If you are using sendmail / postfix on the nagios server, you can check the following log file for errors.

Code: Select all

/var/log/maillog
If you using SMTP to send email from the nagios server, you would have to check the SMTP server's error logs.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Mail delivery

Post by emartine »

If I have a contact that doesn't have an account will they receive notifications?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios XI Mail delivery

Post by jdalrymple »

That depends on what you mean by "receive"

A notification is just Nagios running a command. If the command that you specify for that particular contact (it is a contact object directive) is as follows:

Code: Select all

echo "Stuff is broken" | mail -s "Alert from Nagios" [email protected]
then yes they will "receive" a notification. Similarly if the command is:

Code: Select all

cat /dev/null > /dev/null
That notification will take place and that command will be run - however no person will actually "receive" anything.

Does this make sense?
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Mail delivery

Post by emartine »

I get the alerts when I send through the command line individually. So I guess there may be something wrong with the contact I've created.
In core under Reports --> NOTIFICATIONS I see that the contacts i've created were apparently getting alerts but when I check our mail server logs only those with XI accounts are getting emails. Those contacts with no account are not.

I switched the settings to use Sendmail Instead of SMTP and looked at /var/log/maillog sure enough I noticed that it was only sending to those contacts that had accounts. even though Reports said contacts too. Accounts never received pages however and this concerns me. Are Accounts setup as contacts not supposed to receive both email and page if configured?


I created the following contact and Service
ACCOUNT
COMMON SETTINGS
Contact Name
testcontact
Description
testcontact
Email address
mine@mymailbox
pager number
mypager@mycompany

Active is Checked


ALERT SETTINGS

Host Notifications Enabled
24x7 Time period

Host notification options
d u r f
Host notification command
xi_host_notification_handler
retain status information
ON
Retain Non-status information
ON
Service Notifications Enabled
ON
Service Notifications Timeperiod
24x7 Time period
Service notification Options
u c f r
Service notification command
xi_service_notification_handler
Can Submit Commands
ON

HOST SETTINGS

Hostname
testserver
Description
testserver
address
testserver
displayname
testserver

Check Command
check-host-alive

Check Settings
Check interval min 1
Retry interval min 1
Max check attempts 1
Active checks enabled
ON

Passive checks enabled
OFF
Check period *
xi_timeperiod_24x7
Freshness threshold
300 sec
Check freshness on off skip null
ON

Flap detection enabled
ON
Flap detection options
d o u
Retain status information
ON
Retain non-status information
ON
Process perf data
ON


Alert Settings
Manage contacts --> testcontact

Notification period
xi_timepriod_24x7
Notification options:
d u r f
Notification interval min
30
First notification delay min
0
Notifications enabled:
ON
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Mail delivery

Post by emartine »

Nagios XI 2014R2.6 is the version I am using.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios XI Mail delivery

Post by jdalrymple »

Your contact notification commands have to match up with the type of mail service you're trying to use.

If using sendmail - use notify-service-by-email
If using snmp - use xi_service_notification_handler

Review this document:

http://assets.nagios.com/downloads/nagi ... ios-XI.pdf

Particularly the bit about Notification Commands
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Mail delivery

Post by emartine »

yes they do match.
using smtp and xi_service_notification_handler and xi_host_notification_handler
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios XI Mail delivery

Post by tgriep »

This is from the manual
If you are using Users, which are also Contacts (you've added a Contact to them),
select: xi_host_notification_handler (via the Manage Host Notification Commands button)
and
xi_service_notification_handler (via the Manage Service Notification Commands button)

If you are using Contacts only, select:
notify-host-by-email (via the Manage Host Notification Commands button)
and
notify-service-by-email (via the Manage Service Notification Commands button)
There is another way to setup notifications. Here is the link to it.
http://assets.nagios.com/downloads/nagi ... Mailer.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Mail delivery

Post by emartine »

I am using a mixture of both accounts with contacts and contacts only. So just to be clear. I have a service where I want

Entity 1:
Account userAaccount
Contact userAacount
Which uses:
use xi_service_notification_handler
use xi_host_notification_handler

and

Entity2:
Contact userBcontactonly
Should be using
notify-service-by-email
notify-host-by-email


I want both to receive notifications. Entity 1 should receive email and pager but at this time does not get pages only email.

Per what you just sent me I can't use entity 2 with entity 1. Is this correct?
Locked