六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 1157|回复: 0

Nagios监控Sphinx

[复制链接]
 楼主| 发表于 2015-8-24 15:21:21 | 显示全部楼层 |阅读模式
Nagios监控Sphinx
写了一个插件,check sphinx plugin searchd for nagios,用来监控sphinx的searchd进程。
功能:
1.单独监控一个searchd进程
2.监控多个searchd进程,此时要求每个进程的配置文件放在同一个目录下,有一定的规则可以匹配到。例如:
1[root@chengyongxu.com<script cf-hash="f9e31" type="text/javascript">

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/

3ajax.chengyongxu.com.conf            acmilano.chengyongxu.com.conf            cube.chengyongxu.com.conf

4albums.chengyongxu.com.conf.unused



这样就可以去匹配以conf结尾的配置文件,如果哪个配置不用了,改个名就行。
使用方法:
01#1.登上运行有sphinx的服务器上,下载脚本放到nagios的libexec目录下,例如:

02cd /usr/local/nagios/libexec/

03wget http://down.chengyongxu.com/check_sphinx_searchd

04#

05#2.改属主,加执行权限

06chown nagios:nagios check_sphinx_searchd

07chmod 755 check_sphinx_searchd

08#

09#3.在nrpe.cfg文件中增加下边一行,参数根据你的需要修改

10#----------------------------增加文字-开始----------------------------

11command[check_sphinx_searchd]=/usr/local/nagios/libexec/check_sphinx_searchd -D /usr/local/sphinx/etc -q conf$

12#----------------------------增加文字-结束----------------------------

13#

14#4.保存退出后重启nrpe

15service nrpe restart

16#

17#5.要主监控服务器上增加一个服务监控

18#----------------------------增加文字-开始----------------------------

19    define service{

20    host_name       10.0.0.166

21    service_description       check_sphinx_searchd

22    check_command       check_nrpe!check_sphinx_searchd

23    max_check_attempts       3

24    check_interval       10

25    retry_interval       5

26    check_period       24x7

27    notification_interval       30

28    notification_period       24x7

29    notification_options      w,u,c

30    #contacts       contacts(*)

31    contact_groups       sa_groups

32    }

33#----------------------------增加文字-结束----------------------------

34#

35#6.保存退出后重启nagios

36service nagios restart



脚本内容请见:http://down.chengyongxu.com/check_sphinx_searchd
http://www.chengyongxu.com/blog/nagios%E7%9B%91%E6%8E%A7sphinx/
Nagios监控Sphinx

该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表