在commands.cfg里面加上这么几条(这里我没有把check_memcached装在memcached服务器上,而是通过Nagios的check_memcached直接去访问memcached服务器的11211端口,当然你也可以把他装在memcached服务器上利用check_nrpe来取他的值)
define command {
command_name check_memcached_11211
command_line $USER1$/check_memcached -H 192.168.1.139:11211 --size-warning 80 --size-critical 90
}
上面这个是来监控memcached的内存使用比例
define command {
command_name memcached_response_11211
command_line /usr/local/bin/check_memcached -H 192.168.1.139 -w 300 -c 500
}
这个是用来监控memcached是否还有应答
define command {
command_name check_memcached_hit
command_line /usr/local/bin/check_memcached -H 192.168.1.139 --hit-warning 10 --size-critical 5
}
这个就是命中率啦
最后要在services.cfg里面加点东西
define service{
host_name babeltimeWeb1
service_description memcached_11211
check_command check_memcached_11211
max_check_attempts 3
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups babelgroup
}