[root@Conan_ etc]# grep ^[^#[:space:]] cgi.cfg
main_config_file=/usr/local/nagios/etc/nagios.cfg #告诉CGI主配置文件位置
physical_html_path=/usr/local/nagios/share #This is the physical path where the HTML files for Nagios are kept on your workstation or server
url_html_path=/nagios #访问的uri
show_context_help=0
use_pending_states=1
use_authentication=1 #是否启用认证授权功能
use_ssl_authentication=0 #
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
default_statusmap_layout=5
default_statuswrl_layout=4
ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$
refresh_rate=90
result_limit=100
escape_html_tags=1
action_url_target=_blank
notes_url_target=_blank
lock_author_names=1 2,htpasswd.users:认证用户密码存储文件 3,resource.cfg:变量定义文件,在此文件中定义变量,由其他配置文件引用,如默认的$USER1$ 4,nagios.cfg:nagios主配置文件 log_file=/usr/local/nagios/var/nagios.log:定义日志文件路径 cfg_file=。。。:引用对象配置文件需要在此处添加路径(This directive is used to specify a directory which contains object configuration files) object_cache_file=/usr/local/nagios/var/objects.cache:(This directive is used to specify a file in which a cached copy of object definitionsshould be stored:所有对象的缓存备份文件) status_file=/usr/local/nagios/var/status.dat:状态文件(This is the file that Nagios uses to store the current status, comment, and downtime information) 5,objects/commands.cfg :文件默认存在,不需要修改,新的命令在此文件中添加
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
check-host-alive:命令名字
define service{
use local-service
host_name Nagios-Conan3
service_description Current Load
check_command check_nrpe!check_load
}
注:check_nrpe!check_load--之前在commands.cfg 中创建check_nrpe 的命令定义,此处定义了在被监控主机Nagios-Conan3上需要执行的监控命令。 7,objects/hosts.cfg:需要创建,指定了被监控主机的地址和名字等属性信息
define host{
use linux-server
host_name Nagios-Conan3
address 192.168.1.129
}
define hostgroup{
hostgroup_name linux servers #此处注意不能和localhost.cfg内定义的名字相同
alias Linux Servers1
members Nagios-Conan3
} 8,objects/templates.cfg :nagios主要用于监控主机资源以及服务,在nagios配置中称为对象,为了不必重复定义一些监控对象,nagios引入了一个模板配置文件,将一些共性的属性定义成模板,便于多次引用。此文件每个参数后面都有注释。 9,objects/localhost.cfg:定义了在本机上监控的服务 10,objects/contacts.cfg :定义了联系人和联系人组
define contact{
contact_name nagiosadmin; Short name of user
use generic-contact; Inherit default values from generic-contact template (defined above)
alias Nagios Admin; Full name of user
email nagios@localhost;