接 http://bizchen.blog.51cto.com/1802248/340771
一、监控swap分区
在被监控机/usr/local/nagios/etc/nrpe.cfg里添加
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
监控机/usr/local/nagios/etc/objects/commands.cfg添加
define command{
command_name check_local_swap
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
}
/usr/local/nagios/etc/servers/252.cfg里添加
define service{
use generic-service
host_name 252
service_description Swap Usage
check_command check_nrpe!check_swap
}
重启nagios服务
二、监控load负载情况
监控机/usr/local/nagios/etc/objects/commands.cfg添加(忘了是不是默认有此配置。。。有就不要加了)
define command{
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
/usr/local/nagios/etc/servers/252.cfg里添加
define service{
use generic-service
host_name 252
service_description Current Load
check_command check_nrpe!check_load
}
重启nagios服务
三、监控磁盘使用情况
在被监控机/usr/local/nagios/etc/nrpe.cfg里添加
command[check_disk_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
监控机/usr/local/nagios/etc/objects/commands.cfg添加
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
/usr/local/nagios/etc/servers/252.cfg里添加
define service{
use generic-service
host_name 252
service_description Root Partition
check_command check_nrpe!check_disk_root
}
重启nagios服务
四、监控HTTP
监控机/usr/local/nagios/etc/servers/252.cfg添加
define service{
use generic-service
host_name 252
service_description HTTP
check_command check_http
notifications_enabled 0
}
重启nagios服务
五、监控内存使用情况
由于LINUX使用内存的机制,监控内存没多大必要,还是记录下来
在被监控机/usr/local/nagios/etc/nrpe.cfg里添加
command[check_mem]=/usr/local/nagios/libexec/check_mem -w 150 -c 200
把check_mem(见附件)放到/usr/local/nagios/libexec/下,并赋予权限
chmod +x /usr/local/nagios/libexec/check_mem
chown nagios.nagios /usr/local/nagios/libexec/check_mem
监控端/usr/local/nagios/etc/objects/commands.cfg添加
define command{
command_name check_mem
command_line $USER1$/check_mem -w $ARG1$ -c $ARG2$
}
/usr/local/nagios/etc/servers/252.cfg添加
define service{
use generic-service ; Name of service template to use
host_name 252
service_description memory
check_command check_nrpe!check_mem!110,80!150,100
}
重启nagios服务