Nagios监控Memcached
Nagios的check_memcached
这个插件可以装在memcached服务器上,也可以装在Nagios服务器上,我是直接装在Nagios服务器上这样方便一些.
下载地址:
http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
这个脚本是用perl编的,所以你要先确保自己的机器里面是否有perl环境.
安装方法:
- #cd /usr/local/src/tarbag
- #wget http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
- #tar xzvf Nagios-Plugins-Memcached-0.02.tar.gz -C ../software
- #cd ../software/Nagios-Plugins-Memcached-0.02
- #perl Makefile.PL
执行后会出现一些提示让你选择,一路回车
- #make
这时会下载一些运行时需要的东西
- #make install
默认会把check_memcached文件放到/usr/bin/check_memcached
做个软链接抟到Nagios libexec目录下.
- ln -s /usr/bin/check_memcached /usr/local/nagios/libexec/
- #Memcached
- ### check response time(msec) for memcached
- define command {
- command_name check_memcached_response
- command_line /usr/local/nagios/libexec/check_memcached -H $HOSTADDRESS$:12000 -w $ARG1$ -c $ARG2$
- }
- ### check cache size ratio(bytes/limit_maxbytes[%]) for memcached
- define command {
- command_name check_memcached_size
- command_line /usr/local/nagios/libexec/check_memcached -H $HOSTADDRESS$:12000 --size-warning $ARG1$ --size-critical $ARG2$
- }
- ### check cache hit ratio(get_hits/cmd_get[%]) for memcached
- define command {
- command_name check_memcached_hit
- command_line /usr/local/nagios/libexec/check_memcached -H $HOSTADDRESS$:12000 --hit-warning $ARG1$ --hit-critical $ARG2$
- }
12000端口是我的memcached端口.
然后在memcached主机的cfg配置文件里加上:
- #Memcached
- define service{
- use local-service ; Name of service template to use
- host_name 10.0.0.204
- service_description Memcached_response
- check_command check_memcached_response!300!500
- }
- define service{
- use local-service ; Name of service template to use
- host_name 10.0.0.204
- service_description Memcached_size
- check_command check_memcached_size!90!95
- }
- define service{
- use local-service ; Name of service template to use
- host_name 10.0.0.204
- service_description Memcached_hit
- check_command check_memcached_hit!10!5
- }
最后重启下Nagios. 搞定!
相关推荐
pigsmall 2020-11-19
SXIAOYI 2020-09-16
linuxprobe0 2013-04-01
83560193 2013-06-25
kidneybeans 2013-06-17
加菲猫园 2013-06-16
年轻就要对味 2014-07-11
稻草人的高粱地 2014-07-02
smilebestSun 2014-06-12
xusong 2014-05-17
zfszhangyuan 2013-09-12
80183053 2013-09-12
gaozhlzh 2013-09-11
87453169 2014-01-17
Tom天天 2013-07-12
yaodilu 2020-05-10
有心就有方向 2012-09-03