nagios2------添加监控对象
2014-03-13 13:00
225 查看
① 监控对象
② 配置选项
③ 报警选项
=================================
定义监控对象
nagios.cfg
# vi nagios.cfg
![](http://s3.51cto.com/wyfs02/M01/2B/5E/wKiom1OHeiCRgcmmAACLxNNeSiU292.jpg)
# mkdir servers && cd servers# vi hosts.cfg (修改过nagios的配置文件,生效需要重启nagios)define host{ use linux-server host_name 0.180 alias web1 address 192.168.0.180 hostgroup 192.168.0
}
define hostgroup{
hostgroup_name zg_linux-servers
alias Linux Web Servers
members 192.168
}
# vi services{ use linux-server host_name 0.180 service_description HTTP check_command check_http!80
}
检查配置文件是否有错误;
# bin/nagios -v etc/nagios.cfg
# vi /etc/nrpe.cfg
=================================配置文件选项
cgi.cfg
# vi cgi.cfg
选项:show_context_help=<0/1>
默认:0
说明:是否启用帮助信息。(默认:禁用显示帮助信息)
选项:use_authentication=<0/1>
默认:1
说明:设定访问CGI程序时,是否启用认证。
选项:use_ssl_authentication=<0/1>
默认:0
说明:设定是否使用x509证书认证。
选项:default_user_name
默认:guest
说明:定义一个默认用户,用来访问 CGI ;这是一个替代 web 基本身份认证的方法。
选项:authorized_for_system_commands
默认:nagiosadmin
说明:
nagios.cfg
# vi nagios.cfg
选项:log_file=<file_name>
默认:
说明:指定日志文件;必须是该配置文件的第一个选项。
选项:cfg_file[b]=<file_name> ( & cfg_dir[/b]=<directory_name> )
默认:
说明:对象配置文件。
选项:object_cache_file=<file_name>
默认:
说明:配置对象缓存文件。在启动或重启时读入。
选项:status_update_interval=10
默认:10秒
说明:指定 nagios 查询监控对象的间隔,状态文件更新间隔时间。
选项:nagios_user=nagios
默认:
说明:
选项:nagios_group=nagios
默认:
说明:
选项:log_rotation_method=<n/h/d/w/m>
默认:d
说明:设置日志轮换的方法。(不论换;每小时开始轮换;……周六午夜……)
选项:log_archive_path
默认:
说明:设置归档日志存储的目录。设定日志轮换的情况下,归档日志将会被存储在该目录。
选项:use_syslog=<0/1>
默认:1
说明:是否将日志信息记录到 syslog 设备。
选项:log_notifications=<0/1>
默认:1
说明:是否记录“报警通知”。
选项:log_service_retries=<0/1>
默认:1
说明:是否将检测服务重试的信息进行记录。
选项:enable_notifications=<0/1>
默认:1
说明:启用报警通知
=================================
报警相关选项
nagios.cfg:enable_notifications
templates.cfg > service | host:notifications_enabled
templates.cfg > service | host:notification_options
templates.cfg > service | host:notification_interval
templates.cfg > service | host:notification_period
templates.cfg > contact:almost
与关系
本文出自 “小崔的实验笔记” 博客,谢绝转载!
② 配置选项
③ 报警选项
=================================
定义监控对象
nagios.cfg
# vi nagios.cfg
![](http://s3.51cto.com/wyfs02/M01/2B/5E/wKiom1OHeiCRgcmmAACLxNNeSiU292.jpg)
# mkdir servers && cd servers# vi hosts.cfg (修改过nagios的配置文件,生效需要重启nagios)define host{ use linux-server host_name 0.180 alias web1 address 192.168.0.180 hostgroup 192.168.0
}
define hostgroup{
hostgroup_name zg_linux-servers
alias Linux Web Servers
members 192.168
}
# vi services{ use linux-server host_name 0.180 service_description HTTP check_command check_http!80
}
检查配置文件是否有错误;
# bin/nagios -v etc/nagios.cfg
# vi /etc/nrpe.cfg
server_port=5666#server_address=192.168.1.1allowed_hosts=127.0.0.1,192.168.0.180,117.34.73.193nrpe_user=nagiosnrpe_group=nagios # DEBUGGING OPTION # This option determines whether or not debugging messages are logged to the # syslog facility. # Values: 0=debugging off, 1=debugging on debug=0 # Command definitions that this daemon will run. # # Note: Any plugins that are used in the command lines must reside # on the machine that this daemon is running on! #The examples below assume that you have plugins installed in # a /usr/local/nagios/libexec directory. command[check_users]=/usr/local/nagios/libexec/check_users 5 10 command[check_load]=/usr/local/nagios/libexec/check_load 5 10 15 20 25 30 command[check_disk1]=/usr/local/nagios/libexec/check_disk 80 95 /dev/hda1 command[check_disk2]=/usr/local/nagios/libexec/check_disk 80 95 /dev/hdb1 command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs 5 10 Z command[check_total_procs]=/usr/local/nagios/libexec/check_procs 150 200 |
cgi.cfg
# vi cgi.cfg
选项:show_context_help=<0/1>
默认:0
说明:是否启用帮助信息。(默认:禁用显示帮助信息)
选项:use_authentication=<0/1>
默认:1
说明:设定访问CGI程序时,是否启用认证。
选项:use_ssl_authentication=<0/1>
默认:0
说明:设定是否使用x509证书认证。
选项:default_user_name
默认:guest
说明:定义一个默认用户,用来访问 CGI ;这是一个替代 web 基本身份认证的方法。
选项:authorized_for_system_commands
默认:nagiosadmin
说明:
nagios.cfg
# vi nagios.cfg
选项:log_file=<file_name>
默认:
说明:指定日志文件;必须是该配置文件的第一个选项。
选项:cfg_file[b]=<file_name> ( & cfg_dir[/b]=<directory_name> )
默认:
说明:对象配置文件。
选项:object_cache_file=<file_name>
默认:
说明:配置对象缓存文件。在启动或重启时读入。
选项:status_update_interval=10
默认:10秒
说明:指定 nagios 查询监控对象的间隔,状态文件更新间隔时间。
选项:nagios_user=nagios
默认:
说明:
选项:nagios_group=nagios
默认:
说明:
选项:log_rotation_method=<n/h/d/w/m>
默认:d
说明:设置日志轮换的方法。(不论换;每小时开始轮换;……周六午夜……)
选项:log_archive_path
默认:
说明:设置归档日志存储的目录。设定日志轮换的情况下,归档日志将会被存储在该目录。
选项:use_syslog=<0/1>
默认:1
说明:是否将日志信息记录到 syslog 设备。
选项:log_notifications=<0/1>
默认:1
说明:是否记录“报警通知”。
选项:log_service_retries=<0/1>
默认:1
说明:是否将检测服务重试的信息进行记录。
选项:enable_notifications=<0/1>
默认:1
说明:启用报警通知
=================================
报警相关选项
nagios.cfg:enable_notifications
templates.cfg > service | host:notifications_enabled
templates.cfg > service | host:notification_options
templates.cfg > service | host:notification_interval
templates.cfg > service | host:notification_period
templates.cfg > contact:almost
与关系
本文出自 “小崔的实验笔记” 博客,谢绝转载!
相关文章推荐
- nagios+centreon总结之第五章――nagios+centreon添加监控服务
- nagios 添加需要监控的主机
- NagiosQL添加监控主机及Nagios上启用报警机制
- Nagios添加主机监控失败-故障小结
- NagiosQL添加监控主机及Nagios上启用报警机制 推荐
- shell 自动添加 nagios被监控端
- python+Django实现Nagios自动化添加监控项目 推荐
- nagios监控添加check_http服务
- 【Nagios】nagios服务器添加监控远程Linux主机
- nagios+centreon总结之第五章——nagios+centreon添加监控服务
- 一起搭建linux监控平台之nagios(四)监控端添加服务
- nagios添加监控模块
- Nagios配置—添加linux主机监控
- 手工添加nagios监控的组的流程
- 在nagios里面添加要监控的主机和要监控的服务以及系统参数
- 脚本添加nagios监控主机(带分析) 推荐
- nagios配置――添加linux主机监控
- nagios系列(三)之nagios被动监控模式之添加系统负载load、swap、磁盘iostat及memory内存监控详解
- nagios配置――添加linux主机监控
- python+Django实现Nagios自动化添加监控项目