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

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

Post by bojha »

Hi sreinhardt,

Thank you for your replay.

Yes, you are correct, "alerts from issues are being sent, but using the test mail button is not working" and also as i mentioned earlier, if i am creating a contact only they are not getting the alert. but if i am creating a user with contact during the user creation for the same then they are getting alert.

I verified the contact in the core config manager and checked the host and service notification command for the contact, please find the below definition for a contact

define contact {
contact_name Sanjay Raju
alias Sanjay Raju
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email

email [email protected]
}

Could you please let me know how can i check " local MTA restrictions from the apache user sending mail vs the nagios user" ?

Please suggest me what else i have to check, because i have lots many contact and i don't want to create a user account for them in order to send them alert.


With Regards,

Bijay Ojha
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

This is probably due to the fact that the sendmail core handlers (notify-*-by-email) do not support smtp relays out of the box and need custom commands to do so.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
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 abrist,

Thank you for the replay,

Could you please let me know ? how can i create a custom command ans what values it should contain for the same ?

My Nagios XI Version is --- Nagios XI 2011R1.9

With Regards,

Bijay Ojha
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

First and foremost, I would highly suggest that, if an smtp relay is required in your environment, that all your contacts be associated with XI users so that they can use the php mailer functionality (which includes smtp settings configured through the "manage email settings" interface).

If you really wish to create some core email handlers that support smtp, we can try to help, but depending on your email client/mta/smtp authentication, this can be painful to setup.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
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 abrist,

Thank you for the replay.

i would like to implement your suggestion, and we have already set up the smtp server in the nagios xi interface in admin-> manage email setting .
as i mentioned earlier, if i am creating a contact only they are not getting the alert. but if i am creating a user with contact during the user creation for the same then they are getting alert.

Please find attached the screen shoot of manage email settings.

My understanding is since the users+contacts are getting the alert, that means Nagios Xi server is in the relay list of the smtp server, and the only contacts should be able to get the alert ? but they are not getting ? i don't understand why it is not sending to only contact ? and verified the host_notification_command and service_notification command and they are properly set.

As per your suggestion "if an smtp relay is required in your environment" , do you mean we have to change something in Nagios XI or in smtp server ?

Please suggest me if anything i need to change in Nagios Xi to happen this ..


Thanks in advance..

With Regards,

Bijay Ojha
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

The "manage email settings" smtp options only apply to the phpmailer function. The phpmailer function is unique to XI and XI's user system. These settings cannot be used by contacts that are not associated with an XI user. This is why your user contacts work and just you plain contacts do not. Either:

1. Create users with the exact name as your contacts and change your contacts notification commands to the XI ones
OR:
2. Create a pair of new custom core notification commands using mailx or mail to send to an smtp relay.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
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 abrist,

Thank you for the replay.

I had tried the first option and it was working as expected, but my requirement is to create contact only so i have to follow the second option.

Could you please let me know how can i create a custom core notification command using mail to send to an smtp relay ?
do i need to create custom notification command for each contact?


With Regards,

Bijay Ojha
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

The following commands require mailx:

Code: Select all

yum install mailx
They assume an smtp relay without authentication.
Replace <FROM_ADDRESS> with the proper address.

notify-host-by-email-core

Code: Select all

/usr/bin/printf "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mailx -v -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ ** (C)" -S smtp=smtp -S from=<FROM ADDRESS> $CONTACTEMAIL$
notify-service-by-email-core

Code: Select all

/usr/bin/printf "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mailx -v -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ** (C)" -S smtp=smtp -S from=<FROM_ADDRESS> $CONTACTEMAIL$
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
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 abrist,

Thank you for the replay..

mail client is already installed in the the Linux box where nagios xi is running..
and i checked the mail log By tail -25 /var/log/maillog and the error was
sendmail unable to qualify my own domain name, we resolved that...

Now the only contacts are getting the alert by using the notify-host-by-email and notify-service-by-email command
but whenever i am creating a contact with an email id pointing to group of people([email protected]) they are not getting the alert.
I verified in the home-> notification of Nagios XI UI, there the notification is only showing sending to specific contact like [email protected] but not showing the [email protected] .

all the contacts i have set up in an service templates and more than one services are using this templates.


Could you please suggest me what i need to check ?


Thanks

Bijay

EDIT: Linking to similar email-related thread by same user: support.nagios.com/forum/viewtopic.php?t=21609 - tmcdonald
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

Is your exchange relay the same for groups as it is for the other user's email? If so, the group should not matter as it is just another email address as far as nagios is concerned. If your group email server uses a different relay, you may need to set up new notification commands for those credentials.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked