您的位置:首页 > 移动开发 > IOS开发

nagios2------添加监控对象

2014-03-13 13:00 225 查看
① 监控对象
② 配置选项

③ 报警选项

=================================
定义监控对象

nagios.cfg

# vi nagios.cfg


# 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

与关系

本文出自 “小崔的实验笔记” 博客,谢绝转载!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: