• Nagios监控memcached


    下载地址:
    http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
    http://cpan.uwinnipeg.ca/cpan/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
    这个脚本是用perl编的,所以你要先确保自己的机器里面是否有perl环境,不过一般都会默认安装
    [root@nodea soft]# which perl
    /usr/bin/perl
    下载下来后安装
    [root@nodea soft]# tar xzvf Nagios-Plugins-Memcached-0.02.tar.gz
    [root@nodea soft]# cd Nagios-Plugins-Memcached-0.02
    [root@nodea Nagios-Plugins-Memcached-0.02]# perl Makefile.PL
    执行后会出现一些提示让你选择,按照自己想法选或者一路回车都能通过
    [root@nodea Nagios-Plugins-Memcached-0.02]# make
    这时他会下载一些运行时需要的东西
    [root@nodea Nagios-Plugins-Memcached-0.02]# make install
     
    默认会把check_memcached文件放到/usr/bin/check_memcached
    没关系 把他拷贝到nagios的libexec下
    在commands.cfg里面加上这么几条(这里我没有把check_memcached装在memcached服务器上,而是通过Nagios的check_memcached直接去访问memcached服务器的11211端口,当然你也可以把他装在memcached服务器上利用check_nrpe来取他的值)
     
    ### check cache size ratio(bytes/limit_maxbytes[%]) for memcached    监控memcached的内存使用比例
    define command {
            command_name check_memcached_size
            command_line /usr/local/nagios/libexec/check_memcached -H $HOSTADDRESS$:11211 --size-warning $ARG1$ --size-critical $ARG2$
            }
     
    ### check cache hit ratio(get_hits/cmd_get[%]) for memcached    监控memcached的命中率
    define command {
            command_name check_memcached_hit
            command_line /usr/local/nagios/libexec/check_memcached -H $HOSTADDRESS$:11211 --hit-warning $ARG1$ --hit-critical $ARG2$
            }
     
    define command {
            command_name check_traffic
            command_line $USER1$/check_traffic.sh -V 2c -C public -H $HOSTADDRESS$ -I 1 -w $ARG2$ -c $ARG3$ -K -B
            }
    最后要在services.cfg里面加点东西
    define service{
            use                             local-service-15x7,services-pnp
            host_name                       f1_Multi_Test_118.26.237.164
            service_description             Memcached Response
            servicegroups                   check_memcached_response
            check_command                   check_memcached_response!300!500
            max_check_attempts              2       #检测到故障后最大尝试次数
            normal_check_interval           1       #检测到故障后间隔多少分钟尝试重复连接
            retry_check_interval            1       #检检测到故障后每隔多少分钟发一次报警信息
            }
            define service{
            use                             local-service-15x7,services-pnp
            host_name                       f1_Multi_Test_118.26.237.164
            service_description             Memcached Size
            servicegroups                   check_memcached_size
            check_command                   check_memcached_size!90!95
            process_perf_data               1
            max_check_attempts              2       #检测到故障后最大尝试次数
            normal_check_interval           1       #检测到故障后间隔多少分钟尝试重复连接
            retry_check_interval            1       #检检测到故障后每隔多少分钟发一次报警信息
            }
            define service{
            use                             local-service-15x7
            host_name                       f1_Multi_Test_118.26.237.164
            service_description             Memcached Hit
            servicegroups                   check_memcached_hit
            check_command                   check_memcached_hit!10!5
            max_check_attempts              2       #检测到故障后最大尝试次数
    normal_check_interval           1       #检测到故障后间隔多少分钟尝试重复连接
            retry_check_interval            1       #检检测到故障后每隔多少分钟发一次报警信息
            }
     
    其他的可以按照自己要求添加..
    好了,让我们重新启动下nagios服务
    /etc/init.d/nagios restart
    看看结果
     
    呵呵好了,Nagios监控memcached基本就搞定了
     
    网上其它方法参考:
  • 相关阅读:
    python基础之元组、文件操作、编码、函数、变量
    python---基础之模块,列表,元组,字典
    python成长之路-----day1-----作业(登录程序和三级菜单)
    k8s的port、targetport、nodeport之间的区别
    查找并删除文件
    systemctl自定义service
    中标麒麟7.0源
    springboot问题,没有主清单属性
    iso搭建本地源
    添加路由
  • 原文地址:https://www.cnblogs.com/fjping0606/p/4429014.html
Copyright © 2020-2023  润新知