Sending Emails to contacts based on certain alerts

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.

Sending Emails to contacts based on certain alerts

Postby teknoratti » Fri Apr 29, 2011 9:25 am

I am looking for a way to have emails sent to our different IT personnel based on the alerts.

For example, if the disk space on a server gets critical I would like an email to be sent only to our sys admin. Likewise, if our printers run low on toner I want an email sent only to our IT personnel that handles printers. If routers stop responding I'd like an email to be sent to our network engineer, etc.

Is there a way to do this under Nagios Core?

Thanks
teknoratti
 
Posts: 7
Joined: Fri Apr 29, 2011 9:17 am

Re: Sending Emails to contacts based on certain alerts

Postby cjjags » Fri Apr 29, 2011 10:42 am

You'll have to set up your contacts individually and then add people to contact groups under contactgroups.cfg.

Then add the group to a certain service alert. So it'll look like this:

contacts.cfg


define contact{
contact_name jimbob
alias jimbob
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email jimbob@nagios.net
}

define contact{
contact_name woody
alias woody
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email woody@nagios.net
}

contactgroups.cfg


define contactgroup{
contactgroup_name server
alias Server Admins
members jimbob,woody
}



services.cfg

define service{ ;SERVER
use generic-service
host_name NagiosDC01,NagiosDC2,NagiosExchange
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups server
notification_interval 240
notification_period 24x7
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
cjjags
 
Posts: 4
Joined: Fri Apr 29, 2011 10:32 am

Re: Sending Emails to contacts based on certain alerts

Postby teknoratti » Fri Apr 29, 2011 2:25 pm

Thanks for the reply.

I installed nagios via yum so the install was automated for me. The traditional location of the .cfg files are not the same as a make install as I have no services.cfg file. The closest thing that comes to it is the templates.cfg file

I am still having trouble understanding all the core components of nagios and how the run together.

the contacts.cfg file is not granular as the one you stated either.

I have been trying to tweek it the best way I can.
teknoratti
 
Posts: 7
Joined: Fri Apr 29, 2011 9:17 am

Re: Sending Emails to contacts based on certain alerts

Postby tonyyarusso » Tue May 03, 2011 9:38 am

The names of the config files don't matter - you can use whatever you want, and as many of them as you want. What is installed by yum should be considered as a sample and base to build from, but you can completely rework them to suit your needs, and cjjags' suggestions are one way of doing that. You can take a look at the sections on object definitions in the documentation for more on how the configs are parsed and processed.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
tonyyarusso
 
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA


Return to Nagios Core

Who is online

Users browsing this forum: Majestic-12 [Bot] and 28 guests