zabbix配置(九)之Rabbitmq队列数监控

一、zabbix客户端配置

1、编写zabbix监控脚本

[root@ip-10-0-3-81 zabbix_agentd.conf.d]# cd /usr/local/zabbix/share/zabbix/alertscripts/
[root@ip-10-0-3-81 alertscripts]# vim rabbitmq.sh

#!/bin/bash

/usr/sbin/rabbitmqctl list_queues -p /qq |sed 1d|sed -n '/'$1'/p' |awk -F " " '{print $2}'

2、配置监控配置文件

[root@ip-10-0-3-81 zabbix_agentd.conf.d]# vim /usr/local/zabbix/etc/zabbix_agentd.conf(修改客户端配置文件以下两条配置)

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf

UnsafeUserParameters=1

[root@ip-10-0-3-81 alertscripts]# cd /usr/local/zabbix/etc/zabbix_agentd.conf.d/
[root@ip-10-0-3-81 zabbix_agentd.conf.d]# vim rabbitmq-queues.conf(以下位rabbitmq的14类队列数)

UserParameter=toReturnBonus, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toReturnBonus
UserParameter=reidsToRedisLog, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh reidsToRedisLog
UserParameter=queueTest, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh queueTest
UserParameter=toTrade, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toTrade
UserParameter=toReturnPlatem, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toReturnPlatem
UserParameter=toAccount, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toAccount
UserParameter=toAirdrop, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toAirdrop
UserParameter=toAvgMining, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toAvgMining
UserParameter=toLendPing, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toLendPing
UserParameter=reidsToMysql, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh reidsToMysql
UserParameter=toShopOrder, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toShopOrder
UserParameter=toLendRepay, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toLendRepay
UserParameter=toDmTransaction, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toDmTransaction
UserParameter=toBonusHold, sudo /usr/local/zabbix/share/zabbix/alertscripts/rabbitmq.sh toBonusHold

3、重启zabbix_agentd服务

[root@ip-10-0-3-81 zabbix_agentd.conf.d]# pkill zabbix
[root@ip-10-0-3-81 zabbix_agentd.conf.d]# /usr/local/zabbix/sbin/zabbix_agentd 

二、zabbix_server服务端验证(举一例验证)

[root@ip-10-0-3-61 bin]# ./zabbix_get -s 10.0.3.81 -k eturnBonus(出现以下报错)

zabbix配置(九)之Rabbitmq队列数监控_第1张图片

解决办法:编辑"zabbix-agentd.conf",将"AllowRoot=0"改为"AllowRoot=1"

更改后再一次验证

三、配置web端界面

1、创建监控模板

zabbix配置(九)之Rabbitmq队列数监控_第2张图片

2、应用集占时不考虑,创建监控项

zabbix配置(九)之Rabbitmq队列数监控_第3张图片

我们有十四个队列,这边不一一列举操作,只对其中一个操作,其余的是一样

3、创建触发器

zabbix配置(九)之Rabbitmq队列数监控_第4张图片

4、选择客户端主机将模板加入到监控项内

zabbix配置(九)之Rabbitmq队列数监控_第5张图片

5、制作监控图形

zabbix配置(九)之Rabbitmq队列数监控_第6张图片

6、查看监控数据

zabbix配置(九)之Rabbitmq队列数监控_第7张图片

7、查询图形显示界面情况,因为目前全部的队列数为零,所以我们看到的都是只在0的位置上

zabbix配置(九)之Rabbitmq队列数监控_第8张图片

至此rabbitmq的所有的队列数监控部署完毕

你可能感兴趣的:(zabbix,rabbitmq,云深海阔专栏)