Notification by Mail

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.
Locked
anthonydb
Posts: 4
Joined: Mon Aug 31, 2015 9:33 am

Notification by Mail

Post by anthonydb »

Hello eveyrone, I have just installed FAN with Nagios Core 3.4.4,

My problem is about mail notification for services and hosts. In my mind everything seem to be ok regarding set up. I have hostclients.cfg and for each host or service I have the following :

define service{
use generic-service
host_name vCenter,Veeam
service_description Version de NSClient
check_command check_nt!CLIENTVERSION
contacts user
first_notification_delay 0
notification_interval 0
}

in the hostclient I also have the contact user :
define contact{
contact_name user ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias USER ; Full name of use
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

The template generic-contact has the two notification type enable:

service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email

In the nagios log, notifications seem to be correctly sent :

Warning: Contact 'user' host notification command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\nHost: XXX\nState: DOWN\nAddress: XXX\nInfo: CRITICAL - Host Unreachable (XXX)\n\nDate/Time: Mon+Aug+31+16:31:11+CEST+2015\n" | /usr/bin/Mail -s "** PROBLEM Host Alert: NF1T_02 is DOWN **"[email protected]' timed out after 30 seconds

But in the maillog I cannot find my mail from nagios to [email protected]. Here is an example of maillog:
Aug 31 16:39:01 nagios sendmail[31835]: t7VEcVrR031835: from=nagios, size=0, class=0, nrcpts=0, relay=nagios@localhost

And i don't receive any email...

Can you please help me on this topic ?

Thanks
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Notification by Mail

Post by hsmith »

anthonydb wrote:Hello eveyrone, I have just installed FAN with Nagios Core 3.4.4,

My problem is about mail notification for services and hosts. In my mind everything seem to be ok regarding set up. I have hostclients.cfg and for each host or service I have the following :

define service{
use generic-service
host_name vCenter,Veeam
service_description Version de NSClient
check_command check_nt!CLIENTVERSION
contacts user
first_notification_delay 0
notification_interval 0
}

in the hostclient I also have the contact user :
define contact{
contact_name user ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias USER ; Full name of use
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

The template generic-contact has the two notification type enable:

service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email

In the nagios log, notifications seem to be correctly sent :

Warning: Contact 'user' host notification command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\nHost: XXX\nState: DOWN\nAddress: XXX\nInfo: CRITICAL - Host Unreachable (XXX)\n\nDate/Time: Mon+Aug+31+16:31:11+CEST+2015\n" | /usr/bin/Mail -s "** PROBLEM Host Alert: NF1T_02 is DOWN **"[email protected]' timed out after 30 seconds

But in the maillog I cannot find my mail from nagios to [email protected]. Here is an example of maillog:
Aug 31 16:39:01 nagios sendmail[31835]: t7VEcVrR031835: from=nagios, size=0, class=0, nrcpts=0, relay=nagios@localhost

And i don't receive any email...

Can you please help me on this topic ?

Thanks
Disclaimer: We do not support third party installers, configuration tools, as we didn't write these utilities, and we can't guarantee what they are doing.

With that being said...

Are you able to receive any email whatsoever from Nagios? A lot of times, sendmail gets filtered out by email providers.

Can you also please provide your command defintion for notify-service-by-email and notify-host-by-email?
Former Nagios Employee.
me.
anthonydb
Posts: 4
Joined: Mon Aug 31, 2015 9:33 am

Re: Notification by Mail

Post by anthonydb »

Thanks for your answer, my nagios server don't have an internet connection so i cannot receive mails from the outside. I just want to send email internally on the same local network. I also have a smtp server but i don't know where to put it In the sendmail.mc file ...
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Notification by Mail

Post by hsmith »

anthonydb wrote:Thanks for your answer, my nagios server don't have an internet connection so i cannot receive mails from the outside. I just want to send email internally on the same local network. I also have a smtp server but i don't know where to put it In the sendmail.mc file ...
While I don't have a perfect answer, I did find some things that may help you. This seems like a decent article on the topic.

We also have a thread here where some suggestions were given.
Former Nagios Employee.
me.
anthonydb
Posts: 4
Joined: Mon Aug 31, 2015 9:33 am

Re: Notification by Mail

Post by anthonydb »

Thanks a lot for your answer, I think that I will use the sendemail solution. At the moment I have both sendmail and postfix installed on my nagios server. Perhaps if someone now how to set up Postfix to use an smtp relay it could also be a solution for me.

THanks
anthonydb
Posts: 4
Joined: Mon Aug 31, 2015 9:33 am

Re: Notification by Mail

Post by anthonydb »

Hello everyone, I finally find a solution to this mail issue, I now used sendEmail application to send mail from nagios and it works
Thanks for your help
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Notification by Mail

Post by hsmith »

anthonydb wrote:Hello everyone, I finally find a solution to this mail issue, I now used sendEmail application to send mail from nagios and it works
Thanks for your help
Glad that one worked for you! I'll bookmark those articles for future use :)

Are we all right to close this one out?
Former Nagios Employee.
me.
Locked