There are cases when you want to send email notification to specific email ID for specific host.
there is a configuration file called as contacts.cfg , here we need to add the following :
define contact{
contact_name cocubes
use generic-contact-1
alias cocubes
email user_name@gmail.com
}
contact_name cocubes
use generic-contact-1
alias cocubes
email user_name@gmail.com
}
contact_name is a general name you give to this contact. use --- this the set template mentioned in template.cfg
alias is a general user name
email is the email id
NOTE: open the templeate.cfg
we create a new template called generic-contact-1 , which has the following template
define contact{
name generic-contact-1 ; The name of this contact template
host_notification_period 24x7 ; host notifications can be sent anytime
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
This template basically tell nagios to only send notification if the server is down and not to send service warning.
Now that we have set the email address we have to set the host that we want to monitor
lets open the file windows.cfg
we add contacts variable to the host object
vi /usr/local/nagios/etc/objects/windows.cfg
define host{
use windows-server
host_name cocubes
alias coc.space.com
contacts cocubes
address 202.XX.XXX.XX
}
now restart nagios
No comments:
Post a Comment