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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类