LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Nagios Email Notification (http://www.linuxquestions.org/questions/linux-newbie-8/nagios-email-notification-865886/)

zoomzatag 03-02-2011 01:14 AM

Nagios Email Notification
 
Hi,


i have installed nagios in centos and its working fine.

i need to configure email alerts for nagios

I have already configured nagios to send email alerts for warning,critical and recovery for 24/7.


1) i need to configure nagios to send email alerts twice a day

a) morning at 8am
b) evening at 6pm

2)i need nagios to send email alerts only "current status" of the host and services twice a day (morning and evening).

thanks
ZommZ

EricTRA 03-02-2011 01:40 AM

Hello,

Nagios itself doesn't have a mailserver included. It uses the one installed on your system. If you don't have something like Postfix or Sendmail installed/configured on your system then do so and Nagios will be able to send out mails.

Kind regards,

Eric

zoomzatag 03-02-2011 02:21 AM

Erictra thanks for your reply,


i have already configured nagios to send notification using sendmail.


now i need to configure nagios send me normal status update twice day.

ex: i need nagios to send alert about current status of host and services at 8 am morning.

EricTRA 03-02-2011 02:52 AM

Hi,

As far as I remember Nagios only sends out notification by default if a change in status occurs (warning, critical). I don't think Nagios has any configuration included to send you updates of the status of your devices like you want/need. So that'll be completely up to you to configure. The meaning of Nagios as I understand it is to notify you when something happens, not when all is stable and functioning.

Kind regards,

Eric

Babs 07-20-2011 04:23 AM

Nagios Email Notification
 
I think what you trying to do is possible. Although I am new to this forum and I have also got a question similar to this, what you need to do is to first make sure you have definition in contact.cfg, contactgroups.cfg. This is tricky as you have to have entries in this format in timeperiods.cfg to look something like this::
define timeperiod{
timeperiod_name jackemail_daily
alias jack mail Hours
monday 07:30-07:40
tuesday 07:30-07:40
wednesday 07:30-07:40
thursday 07:30-07:40
friday 07:30-07:40
saturday 07:30-07:40
sunday 07:30-07:40
}
This is the one I did of resent but I have edited my company details of the time period and the alias.
You can give the timeperiod_name anything you want and alias in a format similar to the time period name.
Your contactgroup.cfg settings should look like this:
define contactgroup{
contactgroup_name jack-mail-group
alias jack mail
members jack-mail-monitoring (depending on what your group name is)
}

your contacts.cfg

define contact{
contact_name jack-mail-monitoring
alias jack mail
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email jack-mail-monitoring@whatever -youlike.com
}

Make sure there is aliases entries for jack-mail-monitoring
jack-mail-monitoring: jack.smith, yyy.peter (Depending on the format used in you mail system)

Now you can use a cron to sort out the rest, at best I would advice you set out the cron in /etc/nagios if your environment is using subversion then you would not miss out
your cron should look this formatin /etc/nagios/crontab/nagios

# crontab for nagios.

MAILTO= (group e-mail without brackets)

# check jack-email status & mail
0 8 * * * python /etc/nagios/plugins/jackmail.py | mail -s "comment like hello world" (followed by all emails seperated by space without brackets)
If you have a plugin to be check make entries for it otherwise you can omit it.

This works for me and I hope it works for you.


All times are GMT -5. The time now is 09:20 AM.