Nagios Notificatin by mail
Nagios Notificatin by mail
Hi Nagios,
I have an issue by my mail notification. I do get any mails at the moment still it has worked. I use Nagios Core vers. 4.2.3 on an Linux Ubuntu 14.04. LTS.
I get this from Nagios log when shut down a Server: =>
[1535542909] HOST ALERT: W2012_Tmp;DOWN;SOFT;2;CRITICAL - Host Unreachable (172.31.1.82)
[1535542972] HOST ALERT: W2012_Tmp;DOWN;SOFT;3;CRITICAL - Host Unreachable (172.31.1.82)
[1535543035] HOST ALERT: W2012_Tmp;DOWN;SOFT;4;CRITICAL - Host Unreachable (172.31.1.82)
[1535543098] HOST ALERT: W2012_Tmp;DOWN;SOFT;5;CRITICAL - Host Unreachable (172.31.1.82)
[1535543161] HOST ALERT: W2012_Tmp;DOWN;SOFT;6;CRITICAL - Host Unreachable (172.31.1.82)
[1535543224] HOST ALERT: W2012_Tmp;DOWN;SOFT;7;CRITICAL - Host Unreachable (172.31.1.82)
[1535543287] HOST ALERT: W2012_Tmp;DOWN;SOFT;8;CRITICAL - Host Unreachable (172.31.1.82)
[1535543350] HOST ALERT: W2012_Tmp;DOWN;SOFT;9;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST ALERT: W2012_Tmp;DOWN;HARD;10;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mpn;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mpn;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: stn;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: stn;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mnl;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mnl;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: jj;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: jj;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: pmk;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: pmk;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] wproc: NOTIFY job 82 from worker Core Worker 4159 is a non-check helper but exited with return code 255
[1535543413] wproc: host=W2012_Tmp; service=(none); contact=stn
[1535543413] wproc: early_timeout=0; exited_ok=1; wait_status=65280; error_code=0;
[1535543413] wproc: stderr line 01: ERROR: No message given as ARGV[1] at /usr/local/bin/sendsms.pl line 27.
Her is my Contacts and Commands: =>
###############################################################################
# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
#
#
# NOTES: This config file provides you with some example contact and contact
# group definitions that you can reference in host and service
# definitions.
#
# You don't need to keep these definitions in a separate file from your
# other object definitions. This has been done just to make things
# easier to understand.
#
###############################################################################
###############################################################################
###############################################################################
#
# CONTACTS SMS NOTIFICATIONS
#
###############################################################################
###############################################################################
# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Mxxxxx Pxxxxx ; Full name of
pager 05xxxxxx
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias
pager Mxxxxx Nxxxxxx ; Full name of
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Pxxxx Kxxxx ; Full name of
pager 0045xxxxxx
email pmk@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Sxxxx Nxxxxx ; Full name of
pager
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Jxx Jxxxxxx ; Full name of
pager 0045xxxxxx
email xx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################
# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members xxx, xxx, xxx, xx, xxx
}
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.3.2
#
#
# NOTES: This config file provides you with some example command definitions
# that you can reference in host, service, and contact definitions.
#
# You don't need to keep commands in a separate file from your other
# object definitions. This has been done just to make things easier to
# understand.
#
###############################################################################
################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################
# '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$
}
# Braintower 'notify-host-by-sms' command definition
define command{
command_name notify-host-by-sms
command_line /usr/local/bin/sendsms.pl $CONTACTPAGER$ "Nagios: $NOTIFICATIONTYPE$ - Host $HOSTALIAS$ is $HOSTSTATE$ since $SHORTDATETIME$ info: $HOSTOUTPUT$"
}
# Braintower 'notify-service-by-sms' command definition
If I use "wich mail" I do get this => nguser@Nagios:~$ which mail
/usr/bin/mail
1: Could anybody tell me how I'm able to check why it doesn't work ?
2: Is there anybody who could tell me if I missing something in my contacts or commands definitions
3: My send sms do work it is only my mail notification which is not working
As I wrote it did work and I did get the mail notifications from the mail users at Nagios in my Inbox Outlook
Best Regards
Michael Pierre Nielsen
I have an issue by my mail notification. I do get any mails at the moment still it has worked. I use Nagios Core vers. 4.2.3 on an Linux Ubuntu 14.04. LTS.
I get this from Nagios log when shut down a Server: =>
[1535542909] HOST ALERT: W2012_Tmp;DOWN;SOFT;2;CRITICAL - Host Unreachable (172.31.1.82)
[1535542972] HOST ALERT: W2012_Tmp;DOWN;SOFT;3;CRITICAL - Host Unreachable (172.31.1.82)
[1535543035] HOST ALERT: W2012_Tmp;DOWN;SOFT;4;CRITICAL - Host Unreachable (172.31.1.82)
[1535543098] HOST ALERT: W2012_Tmp;DOWN;SOFT;5;CRITICAL - Host Unreachable (172.31.1.82)
[1535543161] HOST ALERT: W2012_Tmp;DOWN;SOFT;6;CRITICAL - Host Unreachable (172.31.1.82)
[1535543224] HOST ALERT: W2012_Tmp;DOWN;SOFT;7;CRITICAL - Host Unreachable (172.31.1.82)
[1535543287] HOST ALERT: W2012_Tmp;DOWN;SOFT;8;CRITICAL - Host Unreachable (172.31.1.82)
[1535543350] HOST ALERT: W2012_Tmp;DOWN;SOFT;9;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST ALERT: W2012_Tmp;DOWN;HARD;10;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mpn;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mpn;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: stn;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: stn;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mnl;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: mnl;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: jj;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: jj;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: pmk;W2012_Tmp;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] HOST NOTIFICATION: pmk;W2012_Tmp;DOWN;notify-host-by-sms;CRITICAL - Host Unreachable (172.31.1.82)
[1535543413] wproc: NOTIFY job 82 from worker Core Worker 4159 is a non-check helper but exited with return code 255
[1535543413] wproc: host=W2012_Tmp; service=(none); contact=stn
[1535543413] wproc: early_timeout=0; exited_ok=1; wait_status=65280; error_code=0;
[1535543413] wproc: stderr line 01: ERROR: No message given as ARGV[1] at /usr/local/bin/sendsms.pl line 27.
Her is my Contacts and Commands: =>
###############################################################################
# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
#
#
# NOTES: This config file provides you with some example contact and contact
# group definitions that you can reference in host and service
# definitions.
#
# You don't need to keep these definitions in a separate file from your
# other object definitions. This has been done just to make things
# easier to understand.
#
###############################################################################
###############################################################################
###############################################################################
#
# CONTACTS SMS NOTIFICATIONS
#
###############################################################################
###############################################################################
# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Mxxxxx Pxxxxx ; Full name of
pager 05xxxxxx
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias
pager Mxxxxx Nxxxxxx ; Full name of
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Pxxxx Kxxxx ; Full name of
pager 0045xxxxxx
email pmk@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xxx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Sxxxx Nxxxxx ; Full name of
pager
email xxx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
define contact{
contact_name xx ; Short name of user
use generic-contact ; Iherit degault valuses from generic-contact template (defined above)
alias Jxx Jxxxxxx ; Full name of
pager 0045xxxxxx
email xx@fg.dk
host_notification_period 24x7
host_notification_options d,u,r
host_notification_commands notify-host-by-sms,notify-host-by-email
}
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################
# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members xxx, xxx, xxx, xx, xxx
}
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.3.2
#
#
# NOTES: This config file provides you with some example command definitions
# that you can reference in host, service, and contact definitions.
#
# You don't need to keep commands in a separate file from your other
# object definitions. This has been done just to make things easier to
# understand.
#
###############################################################################
################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################
# '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$
}
# Braintower 'notify-host-by-sms' command definition
define command{
command_name notify-host-by-sms
command_line /usr/local/bin/sendsms.pl $CONTACTPAGER$ "Nagios: $NOTIFICATIONTYPE$ - Host $HOSTALIAS$ is $HOSTSTATE$ since $SHORTDATETIME$ info: $HOSTOUTPUT$"
}
# Braintower 'notify-service-by-sms' command definition
If I use "wich mail" I do get this => nguser@Nagios:~$ which mail
/usr/bin/mail
1: Could anybody tell me how I'm able to check why it doesn't work ?
2: Is there anybody who could tell me if I missing something in my contacts or commands definitions
3: My send sms do work it is only my mail notification which is not working
As I wrote it did work and I did get the mail notifications from the mail users at Nagios in my Inbox Outlook
Best Regards
Michael Pierre Nielsen
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Forenede Gruppeliv
2500 Valby
Copenhagen
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Notificatin by mail
I noticed on several of your notification commands you have this
instead of this
Code: Select all
usr/bin/mail
Code: Select all
/usr/bin/mail
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Notificatin by mail
Once that is fixed, you would want to chech the maillog on the server
Code: Select all
tail -50 /var/log/maillog
Re: Nagios Notificatin by mail
Hi Scottwikerson,
thanks for your answer. You wrote to me that I have "serveral" notification commands with this "usr/bin/mail" I found one in my:
=>
# '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$
}
I do only use this cammans right now:
=>
# '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$
}
I have used this shell:
=> tail -50 /var/log/mail.log and got this:
=>
###########################################################################################################################
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 707655602BF: from=<nagios@Nagios.notify>, size=707, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 79F395602D9: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 7CEA95602C3: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 565215602DE: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 5FF4B5602BD: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 5834B5602C4: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 517875602C0: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 8B6585602AA: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 844DA5602CA: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 803A65602BA: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 41BDF5602C1: from=<nagios@Nagios.notify>, size=622, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 6FBD75602BE: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 6D9005602CD: from=<nagios@Nagios.notify>, size=713, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 60AF75602CC: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 637845602B6: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/smtp[1486]: 7CEA95602C3: to=<pmk@fg.dk>, relay=none, delay=1029, delays=1029/0.02/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1488]: 565215602DE: to=<mpn@fg.dk>, relay=none, delay=1004, delays=1004/0.02/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1484]: 79F395602D9: to=<mnl@fg.dk>, relay=none, delay=1004, delays=1004/0.01/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1483]: 707655602BF: to=<jj@fg.dk>, relay=none, delay=1029, delays=1029/0.01/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1490]: 5FF4B5602BD: to=<mnl@fg.dk>, relay=none, delay=72003, delays=72003/0.03/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1495]: 517875602C0: to=<mpn@fg.dk>, relay=none, delay=72003, delays=72003/0.11/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1493]: 5834B5602C4: to=<mnl@fg.dk>, relay=none, delay=1029, delays=1029/0.11/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1496]: 8B6585602AA: to=<mpn@fg.dk>, relay=none, delay=1029, delays=1029/0.12/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1497]: 844DA5602CA: to=<pmk@fg.dk>, relay=none, delay=1004, delays=1004/0.12/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1500]: 803A65602BA: to=<stn@fg.dk>, relay=none, delay=72003, delays=72003/0.12/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
###########################################################################################################################
I really don't understand because I haven't touched my relay parameter on my Exchange Server:
=>
Aug 30 10:54:11 Nagios postfix/error[1495]: 41BDF5602C1: to=<jj@fg.dk>, relay=none, delay=72003, delays=72003/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1500]: 637845602B6: to=<stn@fg.dk>, relay=none, delay=1029, delays=1029/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1493]: 6D9005602CD: to=<jj@fg.dk>, relay=none, delay=1004, delays=1004/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1496]: 6FBD75602BE: to=<pmk@fg.dk>, relay=none, delay=72003, delays=72003/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1497]: 60AF75602CC: to=<stn@fg.dk>, relay=none, delay=1004, delays=1004/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
As you see from mail.log it has something to do with Nagios postfix error. What do you propose ?
Do I have to look at some conf files ? and if where ?
Bedst Regards
Michael Pierre Nielsen
thanks for your answer. You wrote to me that I have "serveral" notification commands with this "usr/bin/mail" I found one in my:
=>
# '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$
}
I do only use this cammans right now:
=>
# '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$
}
I have used this shell:
=> tail -50 /var/log/mail.log and got this:
=>
###########################################################################################################################
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 707655602BF: from=<nagios@Nagios.notify>, size=707, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 79F395602D9: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 7CEA95602C3: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 565215602DE: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 5FF4B5602BD: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 5834B5602C4: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 517875602C0: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 8B6585602AA: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 844DA5602CA: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 803A65602BA: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 41BDF5602C1: from=<nagios@Nagios.notify>, size=622, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 6FBD75602BE: from=<nagios@Nagios.notify>, size=623, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 6D9005602CD: from=<nagios@Nagios.notify>, size=713, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 60AF75602CC: from=<nagios@Nagios.notify>, size=714, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/qmgr[2172]: 637845602B6: from=<nagios@Nagios.notify>, size=708, nrcpt=1 (queue active)
Aug 30 10:54:10 Nagios postfix/smtp[1486]: 7CEA95602C3: to=<pmk@fg.dk>, relay=none, delay=1029, delays=1029/0.02/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1488]: 565215602DE: to=<mpn@fg.dk>, relay=none, delay=1004, delays=1004/0.02/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1484]: 79F395602D9: to=<mnl@fg.dk>, relay=none, delay=1004, delays=1004/0.01/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1483]: 707655602BF: to=<jj@fg.dk>, relay=none, delay=1029, delays=1029/0.01/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/smtp[1490]: 5FF4B5602BD: to=<mnl@fg.dk>, relay=none, delay=72003, delays=72003/0.03/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1495]: 517875602C0: to=<mpn@fg.dk>, relay=none, delay=72003, delays=72003/0.11/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1493]: 5834B5602C4: to=<mnl@fg.dk>, relay=none, delay=1029, delays=1029/0.11/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1496]: 8B6585602AA: to=<mpn@fg.dk>, relay=none, delay=1029, delays=1029/0.12/0/0.07, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1497]: 844DA5602CA: to=<pmk@fg.dk>, relay=none, delay=1004, delays=1004/0.12/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:10 Nagios postfix/error[1500]: 803A65602BA: to=<stn@fg.dk>, relay=none, delay=72003, delays=72003/0.12/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
###########################################################################################################################
I really don't understand because I haven't touched my relay parameter on my Exchange Server:
=>
Aug 30 10:54:11 Nagios postfix/error[1495]: 41BDF5602C1: to=<jj@fg.dk>, relay=none, delay=72003, delays=72003/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1500]: 637845602B6: to=<stn@fg.dk>, relay=none, delay=1029, delays=1029/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1493]: 6D9005602CD: to=<jj@fg.dk>, relay=none, delay=1004, delays=1004/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1496]: 6FBD75602BE: to=<pmk@fg.dk>, relay=none, delay=72003, delays=72003/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
Aug 30 10:54:11 Nagios postfix/error[1497]: 60AF75602CC: to=<stn@fg.dk>, relay=none, delay=1004, delays=1004/0.18/0/0.06, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=fgmail3.fg.dk type=MX: Host not found, try again)
As you see from mail.log it has something to do with Nagios postfix error. What do you propose ?
Do I have to look at some conf files ? and if where ?
Bedst Regards
Michael Pierre Nielsen
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Forenede Gruppeliv
2500 Valby
Copenhagen
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Notificatin by mail
It looks like it is failing to resolve the MX record for the email ending in fgmail3.fg.dk
Does this host exist?
Also, your from address is nagios@Nagios.notify and you should be aware that some mail providers will reject mail if the from address cannot be resolved as well.
Does this host exist?
Also, your from address is nagios@Nagios.notify and you should be aware that some mail providers will reject mail if the from address cannot be resolved as well.
Re: Nagios Notificatin by mail
Hi,
fgmail3.fg.dk is our mail server.
fgmail3.fg.dk is our mail server.
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Forenede Gruppeliv
2500 Valby
Copenhagen
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Notificatin by mail
Your nagios server doesn't know how to resolve the MXmichaelpn wrote:Hi,
fgmail3.fg.dk is our mail server.
do you have the right DNS server
Code: Select all
cat /etc/resolv.conf
Re: Nagios Notificatin by mail
Hi scottwilkerson,
if use that shell I get this:
=>
nguser@Nagios:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search fg.dk
That is a localhost address and our nameserver (NS) has this address ad1.fg.dk.
If I use this shell:
=>
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search fg.dk
And my main.cf looks like this:
=>
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = Nagios
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = Nagios.notify, Nagios, localhost.localdomain, localhost
relayhost = fgmail3.fg.dk
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
I have a strong filing that have to change the nameserver IP 127.0.1.1 to ad1.fg.dk
Please look below:
>>
C:\Users\mpn.FG>nslookup -type=mx domain.com
Server: ad1.fg.dk
Address: 172.31.1.221
Ikke-autoritativt svar:
domain.com MX preference = 10, mail exchanger = mx.domain.com
mx.domain.com internet address = 66.96.140.73
mx.domain.com internet address = 66.96.140.72
C:\Users\mpn.FG>nslookup -type=mx fgmail3.fg.dk
Server: ad1.fg.dk
Address: 172.31.1.221
fg.dk
primary name server = ad1.fg.dk
responsible mail addr = itafd
serial = 34121
refresh = 900 (15 mins)
retry = 600 (10 mins)
expire = 86400 (1 day)
default TTL = 3600 (1 hour)
What do you think ?
How do I change ?
Do you have another pyoposel ?
Bedst Regards
Michael Pierre Nielsen
if use that shell I get this:
=>
nguser@Nagios:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search fg.dk
That is a localhost address and our nameserver (NS) has this address ad1.fg.dk.
If I use this shell:
=>
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search fg.dk
And my main.cf looks like this:
=>
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = Nagios
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = Nagios.notify, Nagios, localhost.localdomain, localhost
relayhost = fgmail3.fg.dk
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
I have a strong filing that have to change the nameserver IP 127.0.1.1 to ad1.fg.dk
Please look below:
>>
C:\Users\mpn.FG>nslookup -type=mx domain.com
Server: ad1.fg.dk
Address: 172.31.1.221
Ikke-autoritativt svar:
domain.com MX preference = 10, mail exchanger = mx.domain.com
mx.domain.com internet address = 66.96.140.73
mx.domain.com internet address = 66.96.140.72
C:\Users\mpn.FG>nslookup -type=mx fgmail3.fg.dk
Server: ad1.fg.dk
Address: 172.31.1.221
fg.dk
primary name server = ad1.fg.dk
responsible mail addr = itafd
serial = 34121
refresh = 900 (15 mins)
retry = 600 (10 mins)
expire = 86400 (1 day)
default TTL = 3600 (1 hour)
What do you think ?
How do I change ?
Do you have another pyoposel ?
Bedst Regards
Michael Pierre Nielsen
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Forenede Gruppeliv
2500 Valby
Copenhagen
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Notificatin by mail
You need to know the IP address of ad1.fg.dk, and replace XXX.XXX.XXX.XXX with that address
Edit /etc/resolvconf/resolv.conf.d/base
Then run
Edit /etc/resolvconf/resolv.conf.d/base
Code: Select all
nameserver XXX.XXX.XXX.XXX
Code: Select all
sudo resolvconf -u
Re: Nagios Notificatin by mail
Hi scottwilkersson,
thanks
If I have to edit the file "base"
I have to use root command to change the file base:
I use vi command => vi /etc/resolvconf/resolv.conf.d/base
If look into the base file I see it is emty!! I think as you wrote to me I have to edit this file so:
put the ip-adrress into the as below written:
=>
nameserver xxx.xxx.x.xx
save the base file and run the command:
=>
sudo resolvconf -u
Is that correct ?
Best Regards
Michael Pierre Nielsen
thanks
If I have to edit the file "base"
I have to use root command to change the file base:
I use vi command => vi /etc/resolvconf/resolv.conf.d/base
If look into the base file I see it is emty!! I think as you wrote to me I have to edit this file so:
put the ip-adrress into the as below written:
=>
nameserver xxx.xxx.x.xx
save the base file and run the command:
=>
sudo resolvconf -u
Is that correct ?
Best Regards
Michael Pierre Nielsen
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Forenede Gruppeliv
2500 Valby
Copenhagen