Service-Side Directory Description:
| Bin |
Nagios executable directory Nagios nagiostats Nrpe
|
| etc |
The Nagios configuration file is in the same directory nagios.cfg contains other configuration files Htpasswd.users Password file nrpe.cfg Client configuration file
|
| Sbin |
The directory where the Nagios CGI files are located, that is, the files required to execute the external command histogram.cgi showlog.cgi statuswrl.cgi |
| Share |
The directory where the Nagios Web page file resides |
| Libexec |
Nagios external plug-in directory Check_ifstatus Check_nrpe |
| Var |
The directory where Nagios log files, lock, and other files are located nagios.log
|
| Var/archives |
Nagios Log Auto Archive directory |
| Var/rw |
The directory used to store external command files |
Location: etc/objects/
Commands.cfg stores the Nagios command-related configuration (optionally specifying the commands directory), where the command is not a system command. Instead, it implements a file that associates the commands in Nagios with the plug-in commands in the Linux system.
SERVICES.CFG store specific monitored service-related configuration content (more than hundred units can specify the services directory, default none)
hosts.cfg storage of specific monitored host-related configuration (more than hundred units can specify the hosts directory, default does not exist)
CONTACTS.CFG Store Alarm Contact-related configuration files
TIMEPERIODS.CFG Storage Alarm cycle time and other related configuration
templates.cfg~ template configuration file, template exists for the convenience of configuration service configuration, similar to shell functions.
Introduction to server-side master profiles and configuration preparation
File generation:
To etc/objects using localhost.cfg to generate hosts.cfg files
head-51 localhost.cfg >hosts.cfg
Chown-r Nagios.nagios hosts.cfg
Create a Serveses.cfg file
Touch services.cfg
Chown-r Nagios.nagios services.cfg
Note Backup:tar zcvf etc.nagios.tar.gz etc/
VI nagios.cfg +34
Cfg_file=/usr/local/nagios/etc/objects/commands.cfg
Cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
Cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
Cfg_file=/usr/local/nagios/etc/objects/templates.cfg
#包含关系, note that the cfg_file= contains the
Added: cfg_file=/usr/local/nagios/etc/objects/services.cfg
Cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
=/usr/local/nagios/etc/objects/localhost.cfg #cfg_file
#不使用localhost.cfg (monitoring of this machine):
# directive as shown below:
#cfg_dir =/usr/local/nagios/etc/servers
#注意: Nagios can also contain directories
X Save exit
118 status_update_interval=5
#监控状态更新间隔
164command_check_interval=2
#尽可能的检测参数, no-1
384 max_service_check_spread=30
#最大的服务检查间隔
---------------------------------------------------------------------------------------------
Service-side Detection service configuration:
Vi/usr/local/nagios/etc/objects, Hosts.cfg
#被监控主机的节点
Define Host{
Use Linux-server
#->/usr/local/nagios/etc/objects/templates.cfg based on the template HOST_NAME host name
Alias aliases
Address node IP
}
Host Group:
Define Hostgroup{
Hostgroup_name linux-servers
Alias Linux Servers
Members Nagios-server22,nagios-server23
}
#逗号, separating the host
-----------------------------------------------------------------------------------------
Vi/usr/local/nagios/etc/objects/serveses.cfg
#定义一个监控的服务:
Define Service{
Use Generic-service; service template
HOST_NAME Nagios; Monitor host name
service_description disk Partition; monitoring partition
Check_command check_nrpe! checck_disk; monitoring commands
}
------------------------------------------------------------------------------------------
Vi/usr/local/nagios/etc/objects/commands.cfg
#定义一个监控的命令
# ' Check_nrpe ' command definition
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$
}
-H Host Address-C Specify parameters (client check name, can not be arbitrarily changed)
Example:/usr/local/nagios/libexec/check_nrpe-h 10.0.0.22-c check_disk
Check syntax:/etc/init.d/nagios checkconfig (no specific error message)
Modified By: Vim/etc/init.d/nagios +183
183 $NagiosBin-V $NagiosCfgFile
#显示错误信息
Or:/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Reboot complete:/etc/init.d/nagios Reload
Nagios error connection refused by host
Troubleshoot with Nagios monitoring principles when troubleshooting
Client/usr/local/nagios/libexec/check_nrpe-h 10.0.0.23-c Check_disk
Firewall off
SELinux off
Nrpe Daemon is started
SS Check Port is ok
Whether the server-side connection is allowed in the Nrpe.cfg
Whether to define the command to check
Check for detection of named X permissions
Service side:/etc/init.d/nagios Reload
In the config file ask no correct
Check if the command name is correct;
This article from "As always" blog, declined reprint!
Nagios directory, file description, and service configuration