|
Nagios监控Sphinx
写了一个插件,check sphinx plugin searchd for nagios,用来监控sphinx的searchd进程。
功能:
1.单独监控一个searchd进程
2.监控多个searchd进程,此时要求每个进程的配置文件放在同一个目录下,有一定的规则可以匹配到。例如:
2 | /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script> ~]# ls /usr/local/sphinx/etc/ |
3 | ajax.chengyongxu.com.conf acmilano.chengyongxu.com.conf cube.chengyongxu.com.conf |
4 | albums.chengyongxu.com.conf.unused |
这样就可以去匹配以conf结尾的配置文件,如果哪个配置不用了,改个名就行。
使用方法:
01 | #1.登上运行有sphinx的服务器上,下载脚本放到nagios的libexec目录下,例如: |
02 | cd /usr/local/nagios/libexec/ |
06 | chown nagios:nagios check_sphinx_searchd |
07 | chmod 755 check_sphinx_searchd |
09 | #3.在nrpe.cfg文件中增加下边一行,参数根据你的需要修改 |
10 | #----------------------------增加文字-开始---------------------------- |
11 | command[check_sphinx_searchd]=/usr/local/nagios/libexec/check_sphinx_searchd -D /usr/local/sphinx/etc -q conf$ |
12 | #----------------------------增加文字-结束---------------------------- |
18 | #----------------------------增加文字-开始---------------------------- |
21 | service_description check_sphinx_searchd |
22 | check_command check_nrpe!check_sphinx_searchd |
27 | notification_interval 30 |
28 | notification_period 24x7 |
29 | notification_options w,u,c |
31 | contact_groups sa_groups |
33 | #----------------------------增加文字-结束---------------------------- |
脚本内容请见:http://down.chengyongxu.com/check_sphinx_searchd
http://www.chengyongxu.com/blog/nagios%E7%9B%91%E6%8E%A7sphinx/
Nagios监控Sphinx
|
|