After the Nagios is installed, its configuration file is/usr/local/nagios/etc/, each profile has a different purpose, and the following are the meanings of each configuration file:
A, profile-related understanding [root@test1~]# cd/usr/local/nagios/etc
[Root@test1 etc]# Ls-l
-rw-rw-r--1 nagios nagios 11408 08-30 11:55 cgi.cfg (CGI configuration file)
-rw-r--r--1 root 08-30 11:56 htpasswd.users (Apache authentication password file)
-rw-rw-r--1 nagios nagios 43776 08-30 11:55 (primary configuration file)
Drwxrwxr-x 2 Nagios nagios 4096 08-30 11:55 (object definition file directory)
-RW-RW----1 Nagios nagios 1340 08-30 11:55 resource.cfg (Resource configuration file)
What we are going to revise is the files in the Nagios.cfg and objects directories to detect if the host is alive or not.
Second, the main configuration file nagios.cfg
The main configuration file is a lot of content, for this version, we need to modify and add the main object configuration file, namely: cfg_file=
CFG_FILE=/USR/LOCAL/NAGIOS/ETC/OBJECTS/COMMANDS.CFG (command definition file)
cfg_file=/usr/local/nagios/etc/objects/ CONTACTS.CFG (Contact information definition file)
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg (Add this row contact Group definition file)
cfg_ File=/usr/local/nagios/etc/objects/hosts.cfg (add this row host definition file)
cfg_file=/usr/local/nagios/etc/objects/ Hostgroups.cfg (Add this row host group definition file)
cfg_file=/usr/local/nagios/etc/objects/services.cfg (add this row service definition file)
cfg_file=/ USR/LOCAL/NAGIOS/ETC/OBJECTS/TIMEPERIODS.CFG (time cycle definition file)
cfg_file=/usr/local/nagios/etc/objects/ Templates.cfg
# Definitions for monitoring the local (Linux) host
#cfg_file =/usr/local/nagios/etc/objects/ Localhost.cfg (Comment out of this row)
Configuration of host definition files
[Root@test1 etc]# VI objects/hosts.cfg
Define Host{
HOST_NAME test1.test.com
Alias Test1
Address 192.168.87.129
Check_command check-host-alive
Check_interval 5
Retry_interval 1
Max_check_attempts 5
Check_period 24x7
Process_perf_data 0
Retain_nonstatus_information 0
Contact_groups Sagroup
Notification_interval 30
Notification_period 24x7
Notification_options D,u,r
}
Configuration of host group definition files
[Root@test1 etc]# VI objects/hostgroups.cfg
Define HostGroup {
Hostgroup_name Nagios
Alias Nagios
Members test1.test.com
}