email notification not working on nagios-3.4.4
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
i think this is the generic service template........
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 2 ; Re-check the service every two minutes until a hard state can be determined
contact_groups admins ; Notifications get sent out to everyone in the 'admins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 60 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 2 ; Re-check the service every two minutes until a hard state can be determined
contact_groups admins ; Notifications get sent out to everyone in the 'admins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 60 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
Re: email notification not working on nagios-3.4.4
So far, I haven't seen anything unusual... See if nagiosadmin is a member of the admins contact group:
Did you restart nagios after you entered your email in the "contacts.cgf"?
Code: Select all
vi /usr/local/nagios/etc/objects/contacts.cfgBe sure to check out our Knowledgebase for helpful articles and solutions!
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
i am getting this msg also often..'you have a new mail '
[root@nagios ~]# vi /usr/local/nagios/etc/objects/templates.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]#
the result of contacts.cfg
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
###############################################################################
###############################################################################
#
# 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 nagiosadmin
}
[root@nagios ~]# vi /usr/local/nagios/etc/objects/templates.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]#
the result of contacts.cfg
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
###############################################################################
###############################################################################
#
# 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 nagiosadmin
}
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
well i checked my mail logs.. i am receiving the service alert notification there...
login as: root
[email protected]'s password:
Last login: Wed Feb 6 16:35:19 2013 from 192.168.193.227
[root@nagios ~]# vi /usr/local/nagios/etc/objects/templates.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]# ^C
You have new mail in /var/spool/mail/root
[root@nagios ~]# vi /usr/local/nagios/etc/objects/contacts.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]# cd /var/spool/mail
You have new mail in /var/spool/mail/root
[root@nagios mail]# ls
akram.chattha nagios root
[root@nagios mail]# vi root
Return-Path: <[email protected]>
Received: from nagios.ioscenterinc.local (localhost.localdomain [127.0.0.1])
by nagios.ioscenterinc.local (8.14.5/8.14.5) with ESMTP id r16FoCFl004093
for <[email protected]>; Wed, 6 Feb 2013 10:50:12 -0500
Received: (from root@localhost)
by nagios.ioscenterinc.local (8.14.5/8.14.5/Submit) id r16FoCKO004088;
Wed, 6 Feb 2013 10:50:12 -0500
Date: Wed, 6 Feb 2013 10:50:12 -0500
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@nagios> /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg .logging /var/log/mrtg.log
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
ERROR: unable to open config file: /etc/mrtg/mymrtg.cfg
From [email protected] Wed Feb 6 10:55:12 2013
Return-Path: <[email protected]>
Received: from nagios.ioscenterinc.local (localhost.localdomain [127.0.0.1])
by nagios.ioscenterinc.local (8.14.5/8.14.5) with ESMTP id r16FtBIS004183
for <[email protected]>; Wed, 6 Feb 2013 10:55:11 -0500
Received: (from root@localhost)
by nagios.ioscenterinc.local (8.14.5/8.14.5/Submit) id r16FtBa1004179;
Wed, 6 Feb 2013 10:55:11 -0500
Date: Wed, 6 Feb 2013 10:55:11 -0500
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@nagios> /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg .logging /var/log/mrtg.log
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
ERROR: unable to open config file: /etc/mrtg/mymrtg.cfg
login as: root
[email protected]'s password:
Last login: Wed Feb 6 16:35:19 2013 from 192.168.193.227
[root@nagios ~]# vi /usr/local/nagios/etc/objects/templates.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]# ^C
You have new mail in /var/spool/mail/root
[root@nagios ~]# vi /usr/local/nagios/etc/objects/contacts.cfg
You have new mail in /var/spool/mail/root
[root@nagios ~]# cd /var/spool/mail
You have new mail in /var/spool/mail/root
[root@nagios mail]# ls
akram.chattha nagios root
[root@nagios mail]# vi root
Return-Path: <[email protected]>
Received: from nagios.ioscenterinc.local (localhost.localdomain [127.0.0.1])
by nagios.ioscenterinc.local (8.14.5/8.14.5) with ESMTP id r16FoCFl004093
for <[email protected]>; Wed, 6 Feb 2013 10:50:12 -0500
Received: (from root@localhost)
by nagios.ioscenterinc.local (8.14.5/8.14.5/Submit) id r16FoCKO004088;
Wed, 6 Feb 2013 10:50:12 -0500
Date: Wed, 6 Feb 2013 10:50:12 -0500
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@nagios> /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg .logging /var/log/mrtg.log
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
ERROR: unable to open config file: /etc/mrtg/mymrtg.cfg
From [email protected] Wed Feb 6 10:55:12 2013
Return-Path: <[email protected]>
Received: from nagios.ioscenterinc.local (localhost.localdomain [127.0.0.1])
by nagios.ioscenterinc.local (8.14.5/8.14.5) with ESMTP id r16FtBIS004183
for <[email protected]>; Wed, 6 Feb 2013 10:55:11 -0500
Received: (from root@localhost)
by nagios.ioscenterinc.local (8.14.5/8.14.5/Submit) id r16FtBa1004179;
Wed, 6 Feb 2013 10:55:11 -0500
Date: Wed, 6 Feb 2013 10:55:11 -0500
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@nagios> /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg .logging /var/log/mrtg.log
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
ERROR: unable to open config file: /etc/mrtg/mymrtg.cfg
Re: email notification not working on nagios-3.4.4
mail logs always make me go cross-eyed, I'm assuming if you try to send an email manually from the command line it also ends up in your root mail?
Maybe test that and hopefully we can rule out Nagios as the cause of any grief here, then double check your sendmail/postfix/whatever config if it does turn out to be the MTA.
Edit: Never mind it looks like it's never attempting to send to the email address you specified so it probably is Nagios specific. After you made the email configuration change in Nagios... did you restart it?
Maybe test that and hopefully we can rule out Nagios as the cause of any grief here, then double check your sendmail/postfix/whatever config if it does turn out to be the MTA.
Edit: Never mind it looks like it's never attempting to send to the email address you specified so it probably is Nagios specific. After you made the email configuration change in Nagios... did you restart it?
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
Hello jsmurphy,
yea i did restart nagios after changing email address in contacts.cfg
.....
Also in the past i installed the nagios-3.2.3 and plugins-1.4.11
The email notifications were working fine at that time.
SO i thought may be email notification works different in nagios-3.4.4 with plugins-1.4.16
On test fedora machine i installed nagios-3.2.3 again with plugins-1.4.11 but this time email notifications are not working even on that version.
i am not sure if nagios changed the way their email notification works or their configuration.
yea i did restart nagios after changing email address in contacts.cfg
.....
Also in the past i installed the nagios-3.2.3 and plugins-1.4.11
The email notifications were working fine at that time.
SO i thought may be email notification works different in nagios-3.4.4 with plugins-1.4.16
On test fedora machine i installed nagios-3.2.3 again with plugins-1.4.11 but this time email notifications are not working even on that version.
i am not sure if nagios changed the way their email notification works or their configuration.
Re: email notification not working on nagios-3.4.4
Run this command in terminal and see if you are going to get an email:
Code: Select all
echo "test" | mail -s "test mail" [email protected]Be sure to check out our Knowledgebase for helpful articles and solutions!
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
i got this reply..
[root@nagios mail]# echo "test" | mail -s "test mail" [email protected]
bash: mail: command not found...
You have new mail in /var/spool/mail/root
[root@nagios mail]# echo "test" | mail -s "test mail" [email protected]
bash: mail: command not found...
You have new mail in /var/spool/mail/root
Re: email notification not working on nagios-3.4.4
Is your notify-x-by-email command definitions configured to use mail or mailx? I think the default for newer versions of red hat use mailx instead... try the same command but replace the world mail with mailx.
-
nagios@ios
- Posts: 19
- Joined: Wed Feb 06, 2013 5:09 pm
Re: email notification not working on nagios-3.4.4
[root@nagios ~]# echo "test" | mailx -s "test mail" [email protected]
bash: mailx: command not found...
You have new mail in /var/spool/mail/root
bash: mailx: command not found...
You have new mail in /var/spool/mail/root