NOTE: These directories might be in a different location depending on if you installed from source, apt, or yum.
Edit your nagios/etc/nagios.cfg file so that is has include directories like so (use your directory paths, not mine):
Code: Select all
cfg_dir=/usr/local/nagios/etc/hosts
cfg_dir=/usr/local/nagios/etc/services
Then create a new host config file in the hosts directory:
/usr/local/nagios/etc/hosts
That looks something like this:
Code: Select all
define host {
host_name www.facebook.com
use my_host_template
address www.facebook.com
contacts dummy
register 1
}
I recommend defining all other settings in a common template.
Then create a config file in your services directory like so:
mine is: /usr/local/nagios/etc/services
Code: Select all
define service {
host_name www.facebook.com
service_description DNS IP Match
use my_service_template
check_command check_dns!-a 66.220.149.25
contacts dummy
register 1
}
Again, use common settings in a template. Put all of your service definitions for that host in a single file so that way it's organized and easy to find.