nagios远程监控必须依赖于nrpe
不知道什么是nrpe的,此文略过
监控端需求 path/to/nagios/libexc/check_nrpe
被控端需求 nrpe --daemon
监控端配置checkcommand示例
define command {
command_name check_remote
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
被控端配置nrpe.cfg示例
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_droot]=/usr/local/nagios/libexec/check_disk -w 30% -c 20% -p /dev/sda2
command[check_dhome2]=/usr/local/nagios/libexec/check_disk -w 30% -c 20% -p /dev/sdb1
command[check_cpu]=/usr/local/nagios/libexec/check_procs -w 150 -c 250 --metric=CPU
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 400 -c 600
command[check_mysqlcpu]=/usr/local/nagios/libexec/check_procs -w 100 -c 200 -u mysql -m CPU
command[check_whoistop]=/usr/local/nagios/libexec/check_whoistop 100 200
监控端service配置实例
define service {
service_description check_whoistop
check_command check_remotecheck_whoistop
host_name php218
check_period 24x7
notification_period 24x7
contact_groups admins
event_handler_enabled 0
notification_interval 15
notification_options w,u,c,r
max_check_attempts 3
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_freshness 0
freshness_threshold 86400
}
check_remote:服务端本地的command;调用本地check_nrpe来执行被控端的check_whoistop命令,check_whoistop在被控端的nrpe.cfg内定义
关于自定义的监控插件check_whoistop 见:
http://blog.csdn.net/sudoers/article/details/6913368