Email notification

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
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Email notification

Post by Nessero »

Hi ! Configure nagios and postfix to send email and nothing work.

nagios command.cfg:

Code: Select all

#'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }


#'notify-service-by-email' command definition
define command{
command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
postfix configure like this http://www.telnetport25.com/2012/02/con ... gios-core/ and relay https://www.freelock.com/kb/postfix-relayhost
Send custom messega from web of nagios and its dont delivered.
in /var/log/nagios/ :

Code: Select all

[1491974038] Successfully launched command file worker with pid 27238
[1491974062] EXTERNAL COMMAND: SEND_CUSTOM_HOST_NOTIFICATION;server1;0;Nagios Admin;test
postfix log is empy
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Email notification

Post by mcapra »

Did you follow a particular guide for the Nagios end of things when setting this up?

Does your contact have the proper host_notification_commands and service_notification_commands set?

Can you share the output of which mail? The default Linux MTA doesn't typically recognize Postfix unless you tell it to.
Former Nagios employee
https://www.mcapra.com/
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: Email notification

Post by Nessero »

mcapra wrote:Did you follow a particular guide for the Nagios end of things when setting this up?

Does your contact have the proper host_notification_commands and service_notification_commands set?

Can you share the output of which mail? The default Linux MTA doesn't typically recognize Postfix unless you tell it to.
Yep i don't set notification commands in contact.cfg. Anover question. Where configure how often notifications sent to mail ?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Email notification

Post by mcapra »

That would be done with the notification_interval and notification_timeperiod in your service/host definitions.

More info here:
https://assets.nagios.com/downloads/nag ... tions.html
Former Nagios employee
https://www.mcapra.com/
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: Email notification

Post by Nessero »

mcapra wrote:That would be done with the notification_interval and notification_timeperiod in your service/host definitions.

More info here:
https://assets.nagios.com/downloads/nag ... tions.html
Thx to you.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Email notification

Post by dwhitfield »

Did you have any more questions or are we ready to close? Thanks!
Nessero
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am

Re: Email notification

Post by Nessero »

dwhitfield wrote:Did you have any more questions or are we ready to close? Thanks!
Ready to close. Thanks!
Locked