涛子 - 简单就是美

成单纯魁增,永继振国兴,克复宗清政,广开家必升

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

doc

http://labs.consol.de/nagios/mod-gearman/

安装

yum -y install gearmand-server-0.33-2.rhel6.x86_64.rpm 
yum -y install gearmand-0.33-2.rhel6.x86_64.rpm 
yum -y install gearmand-devel-0.33-2.rhel6.x86_64.rpm 
yum -y install mod_gearman2-2.1.2-1.rhel6.x86_64.rpm 

启动gearmand

/etc/init.d/gearmand start && chkconfig gearmand on

/var/log/gearman.log
  ERROR 2015-04-08 09:34:56.000000 [  main ] socket()(Address family not supported by protocol) -> libgearman-server/gearmand.cc:468
  ERROR 2015-04-08 09:34:56.000000 [  main ] gearmand_sockfd_close() called with an invalid socket -> libgearman-server/io.cc:933

原因:ipv6被禁用。p
解决:/etc/init.d/gearmand 
变更 daemon --pidfile=$pidfile --user=gearmand $gearmand -d $OPTIONS -L 0.0.0.0

# 服务端口4730 
# /usr/sbin/gearmand -d --worker-wakeup=10 --retention-file=/tmp/gearmand.retention -q retention --log-file=/var/log/gearmand/gearmand.log -L 0.0.0.0

启动worker

/etc/init.d/mod-gearman2-worker start && chkconfig mod-gearman2-worker  on
# /usr/bin/mod_gearman2_worker -d --config=/etc/mod_gearman2/worker.conf --pidfile=/var/mod_gearman2/mod_gearman_worker.pid

gearmand配置

/etc/mod_gearman2/module.conf

debug=0     # 0 显示错误信息 1-4 不同级别debug信息 5 所有信息
logfile=/var/log/mod_gearman2/mod_gearman_neb.log
server=localhost:4730    # 指定1台或多台gearman server,如 localhost:4730,remote_host:4730

eventhandler=yes
services=yes
hosts=yes
hostgroups=name1,name2,name3
servicegroups=name1,name2,name3

do_hostchecks=yes # 指定此项,必须指定hosts' or 'hostgroups'
route_eventhandler_like_checks=no

encryption=yes   # 加密,如果指定,必须使用key或者keyfile用于共享使用
key=should_be_changed
# keyfile=/etc/mod_gearman/secret.file
use_uniq_jobs=on

localhostgroups=   # 不使用gearman的主机组
localservicegroups=    # 不使用gearman的服务组


result_workers=1
perfdata=no
perfdata_mode=1       # 1: overwrote ,  2: append

orphan_host_checks=yes
orphan_service_checks=yes

accept_clear_results=no

/etc/mod_gearman2/worker.conf

debug=0  # 0: error,  1: debug, 2: trace,  3: all
eventhandler=yes

services=yes
hosts=yes

hostgroups=name1
hostgroups=name2,name3
servicegroups=name1,name2,name3

encryption=yes
key=should_be_changed
#keyfile=/path/to/secret.file

#pidfile=/var/mod_gearman2/mod_gearman_worker.pid

job_timeout=60
min-worker=5
max-worker=50
idle-timeout=30
max-jobs=1000
spawn-rate=1
fork_on_exec=no

load_limit1=0
load_limit5=0
load_limit15=0

show_error_output=yes
#dup_results_are_passive=yes

enable_embedded_perl=on
use_embedded_perl_implicitly=off
use_perl_cache=on
p1_file=/usr/share/mod_gearman2/mod_gearman_p1.pl
#restrict_path=/usr/local/plugins/
workaround_rc_25=off

nagios配置

# /etc/nagios/nagios.cfg
broker_module=/usr/lib64/mod_gearman2/mod_gearman2.o keyfile=/etc/nagios/secret.txt server=localhost eventhandler=yes hosts=yes services=yes
or 
broker_module=/usr/lib64/mod_gearman2/mod_gearman2.o config=/etc/mod_gearman2/module.conf

# 可以使用直接使用参数,或者从配置文件中读取

cat /var/log/nagios/nagios.log
......
Event broker module '/usr/lib64/mod_gearman2/mod_gearman2.o' initialized successfully.
......
gearadmin --status
gearadmin --workers
gearman_top2
posted on 2015-04-03 14:32  北京涛子  阅读(608)  评论(0编辑  收藏  举报