Nagios monitoring memcached
Last Update:2015-04-15
Source: Internet
Author: User
<span id="Label3"></p><span style="font-size: 14px;"><span style="font-size: 14px;">:</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">http://cpan.uwinnipeg.ca/cpan/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">This script is made in perl, so you have to make sure you have a Perl environment in your machine, but it will usually be installed by default</span> .</span><span style="font-size: 14px;"><span style="font-size: 14px;">[email protected] soft]# which Perl</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">/usr/bin/perl</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">download down after install</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">[email protected] soft]# tar xzvf nagios-plugins-memcached-0.02.tar.gz</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">[email protected] soft]# cd nagios-plugins-memcached-0.02</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">[email protected] nagios-plugins-memcached-0.02]# perl makefile.pl</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">after execution, there will be some hints for you to choose, to follow your own ideas or to return to the same pass</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">[[email protected] nagios-plugins-memcached-0.02]#</span> make</span><span style="font-size: 14px;"><span style="font-size: 14px;">Then he downloads something that needs to be Run.</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">[[email protected] nagios-plugins-memcached-0.02]# make install</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;">by default, The check_memcached file is placed in the/usr/bin/check_memcached</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">It's okay to copy him under Nagios's libexec.</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">add a few in the Commands.cfg (here I didn't put check_memcached on the memcached server, but through Nagios's check_ Memcached directly to access the port of the memcached server 11211, you can also install him on the memcached server using Check_nrpe to fetch his Value)</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;"># # # Check Cache size ratio (bytes/limit_maxbytes[%]) for memcached monitoring memcached memory usage ratio</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">define Command {</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_name check_memcached_size</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_line/usr/local/nagios/libexec/check_memcached-h $HOSTADDRESS $:11211--size-warning $ARG 1$--SIZE-CRI Tical $ARG 2$</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;"># # # Check Cache hits ratio (get_hits/cmd_get[%]) for memcached monitoring memcached hit</span> rate</span><span style="font-size: 14px;"><span style="font-size: 14px;">define Command {</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_name Check_memcached_hit</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_line/usr/local/nagios/libexec/check_memcached-h $HOSTADDRESS $:11211--hit-warning $ARG 1$--hit-criti Cal $ARG 2$</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;">define Command {</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_name check_traffic</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">command_line $USER 1$/check_traffic.sh-v 2c-c public-h $HOSTADDRESS $-i 1-w $ARG 2$-c $ARG 3$-k-b</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">finally, add something to the Services.cfg.</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">define service{</span></span><span style="font-size: 14px;">use <span style="font-size: 14px;">Local-service-15x7,services-pnp</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">host_name f1_multi_test_118.26.237.164</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">service_description Memcached Response</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">servicegroups Check_memcached_response</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Check_command check_memcached_response!300!500</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">max_check_attempts 2 #检测到故障后最大尝试次数</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Normal_check_interval 1 #检测到故障后间隔多少分钟尝试重复连接</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Retry_check_interval 1 #检检测到故障后每隔多少分钟发一次报警信息</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">define service{</span></span><span style="font-size: 14px;">use <span style="font-size: 14px;">Local-service-15x7,services-pnp</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">host_name f1_multi_test_118.26.237.164</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">service_description Memcached Size</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">servicegroups check_memcached_size</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Check_command check_memcached_size!90!95</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Process_perf_data 1</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">max_check_attempts 2 #检测到故障后最大尝试次数</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Normal_check_interval 1 #检测到故障后间隔多少分钟尝试重复连接</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Retry_check_interval 1 #检检测到故障后每隔多少分钟发一次报警信息</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">define service{</span></span><span style="font-size: 14px;">use <span style="font-size: 14px;">local-service-15x7</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">host_name f1_multi_test_118.26.237.164</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">service_description Memcached</span> hit</span><span style="font-size: 14px;"><span style="font-size: 14px;">servicegroups Check_memcached_hit</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Check_command check_memcached_hit!10!5</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">max_check_attempts 2 #检测到故障后最大尝试次数</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Normal_check_interval 1 #检测到故障后间隔多少分钟尝试重复连接</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Retry_check_interval 1 #检检测到故障后每隔多少分钟发一次报警信息</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> }</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;">the others can be added according to their own requirements</span> .</span><span style="font-size: 14px;"><span style="font-size: 14px;">okay, Let's restart the Nagios service.</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">/etc/init.d/nagios Restart</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">look at the results</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;">oh, well, Nagios surveillance memcached is basically done.</span></span><span style="font-size: 14px;"><span style="font-size: 14px;"> </span></span><span style="font-size: 14px;"><span style="font-size: 14px;">Other methods of online reference:</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">http://storysky.blog.51cto.com/628458/244962/</span></span><span style="font-size: 14px;"><span style="font-size: 14px;">http://blog.csdn.net/deccmtd/article/details/6799647</span></span><p><p>Nagios monitoring memcached</p></p></span>