Assuming that you have set up your nagios server and you just have to add a new host in the server.
By the way which OS you are using?
Here I'm telling you the configuration on Ubuntu. I'm taking an example of adding google as your new host.
Now first make a new object definition file by typing:
Quote:
#sudo vim /usr/local/nagios/etc/objects/google.cfg
|
and adding the following lines to it:
Code:
# Define a host for the local machine
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name google.com
alias google.com
address www.google.com
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "ping" the local machine
define service{
use generic-service ; Name of service template to use
host_name google.com
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
define service{
use generic-service ; Name of service template to use
host_name google.com
service_description HTTP
check_command check_http
notifications_enabled 0
}
now edit your main config file to tell it the location of the new config file:
Quote:
#sudo vim /usr/local/nagios/etc/nagios.cfg
|
add the folowwing line to the file:
Quote:
cfg_file=/usr/local/nagios/etc/objects/google.cfg
|
Now restart your nagios daemon:
Quote:
#sudo /etc/init.d/nagios restart
|
if you get any errors when restarting run the following command to check for problems with your config files:
Quote:
#sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
|