not able to send the test mail but getting all alert

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

not able to send the test mail but getting all alert

Post by bojha »

Hi All,

We are running Nagios XI 2011R1.9 and for the notification we have set up an smtp server (smtp.xxxx.com) and connecting to the port 25 and we are able to get all the alerts related to any host or service but when we are trying to send an test mail it is throwing an error ...and we are not getting any test mail.

Please find the below errors

ADDRESSES Array ( [0] => Array ( [name] => [email] => [email protected] ) ) SMTP Error: Could not connect to SMTP host.
Test Email Settings

A test email was sent to [email protected]
----
Mailer said: SMTP Error: Could not connect to SMTP host. (method=smtp;host=smtp.xxxx.com;port=25;security=none)
An error occurred sending a test email!
Use this to test your mail settings.
An email will be sent to: [email protected]

Change your email address


Please suggest me if anything i need to change/modify in nagios xi configuration. or do i need to make any changes to the smtp server ?(My understanding is since we are getting the alert for services that means Nagios XI is already in the relay list of the smtp server i am confused......).

Thanks in advance.


With Regards,

Bijay Ojha
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: not able to send the test mail but getting all alert

Post by sreinhardt »

Well, yes it does, and no it does not mean that nagios is on the relay list. Lets start with a few things:

1) Are these users or contacts that are getting notifications?
2) What notification handler are you using?
3) Please run the following command and return it to me:
nmap -p 25 smtp.xxxx.com (your mail server)
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: not able to send the test mail but getting all alert

Post by bojha »

Hi sreinhardt,

Thank you for the replay.

Please find below the answer to the questions

1. Not sure whether all the users or contact are getting alert but i am sure some of the users(including me ) are getting the alerts.
2. I have checked the contact template and below are the notification handlers getting used.

host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler

3.[root@nagiosvm01 ~]# nmap -p 25 smtp.xxxx.com

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-08-26 01:00 EDT
Warning: Hostname smtp.xxxx.com resolves to 2 IPs. Using 10.111.20.128.
Interesting ports on 10.111.20.128:
PORT STATE SERVICE
25/tcp open smtp

Nmap finished: 1 IP address (1 host up) scanned in 0.202 seconds
[root@nagiosvm01 ~]#

With Regards,

Bijay Ojha
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: not able to send the test mail but getting all alert

Post by slansing »

Be sure to follow these guidelines as they can cause the problem you are experiencing:
If you are using Users, which are also Contacts (you've
added a Contact to them), select:

xi_host_notification_handler (under "Manage Host
Notification Commands")
and

xi_service_notification_handler (under "Manage
Service Notification Commands")
If you are using Contacts only, select:

notify-host-by-email (under "Manage Host
Notification Commands")
and

notify-service-by-email (under "Manage Service
Notification Commands")
source: http://assets.nagios.com/downloads/nagi ... ations.pdf
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: not able to send the test mail but getting all alert

Post by bojha »

Hi slansing,


Thank you for the replay,

I have verified the contact definition and the handlers are setup properly by considering me (i am a user and contact as well) but again throwing the same error.

please find my contact and contact template definition.

define contact {
contact_name bojha
alias Bijay Ojha
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period bojha_notification_times
service_notification_period bojha_notification_times
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
email [email protected]
host_notifications_enabled 1
service_notifications_enabled 1
use xi_contact_generic
}

Contact Template

define contact {
name xi_contact_generic
contactgroups xi_contactgroup_all
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler
register 0
}

###############################################################################
#
# Contacttemplate configuration file
#


Please let me know if i have to check anything else.

With Regards,

Bijay Ojha
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: not able to send the test mail but getting all alert

Post by slansing »

Can you send a screenshot of Admin > Manage Email Settings, you can blank out anything you do not wish to share. What MTA are you using for the XI server? Just the defaults that are on the system when it is ran as a VM or installed over a basic Centos/RHEL server that has not been edited by your company?
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: not able to send the test mail but getting all alert

Post by bojha »

Hi slansing,

please find attached the screen shoot.


I am not sure whether it has been edited or not ? because this instance was there even before i joined this company, Could you please let me know where i have to check for the information you have asked ?
What MTA are you using for the XI server? Just the defaults that are on the system when it is ran as a VM or installed over a basic Centos/RHEL server that has not been edited by your company?

One observation i did is, created one contact and set up the alert, the contact is not getting the alert but i created one user for the same and during the user creation checked to create a contact then he is getting the alert. in both the case i had used the same mail id


With Regards,

Bijay Ojha
You do not have the required permissions to view the files attached to this post.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: not able to send the test mail but getting all alert

Post by slansing »

Well then your mailserver and MTA should be fine. Are you sure the contacts are set to use the proper host and service notification handlers? If you created a User + Contact then it would be using the xi_notify* commands. The contacts by themselves should only ever use the notify-* commands.
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: not able to send the test mail but getting all alert

Post by bojha »

Hi slansing,

Thank you for your replay.
Yes i am sure and double checked the notification handler for the contact for host and service command but the alerts are not coming. i don't understand why it is not coming, please suggest me if i have to check anything else ?


Thanks in advance..


With Regards,

Bijay Ojha
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: not able to send the test mail but getting all alert

Post by sreinhardt »

Does your local MTA happen to have any restrictions from the apache user sending mail vs the nagios user? If I am understanding correctly, alerts from issues are being sent, but using the test mail button is not working, right?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked