Email notification

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Email notification

Postby Nessero » Wed Apr 12, 2017 12:36 am

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

Re: Email notification

Postby mcapra » Wed Apr 12, 2017 10:51 am

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
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 2826
Joined: Thu May 05, 2016 3:54 pm

Re: Email notification

Postby Nessero » Wed Apr 12, 2017 10:25 pm

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

Re: Email notification

Postby mcapra » Thu Apr 13, 2017 1:29 pm

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
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 2826
Joined: Thu May 05, 2016 3:54 pm

Re: Email notification

Postby Nessero » Thu Apr 13, 2017 10:33 pm

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

Re: Email notification

Postby dwhitfield » Fri Apr 14, 2017 7:55 am

Did you have any more questions or are we ready to close? Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3842
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: Email notification

Postby Nessero » Tue Apr 18, 2017 11:16 pm

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


Ready to close. Thanks!
Nessero
 
Posts: 10
Joined: Wed Apr 12, 2017 12:18 am


Return to Nagios Core

Who is online

Users browsing this forum: rafael and 23 guests

cron