Py学习  »  MQ

需要为rabbitmq监视用户分配的权限

ThommyB • 4 年前 • 662 次点击  

我需要为将监视我的rabbitmq服务器的软件分配哪些权限?软件代理应该监控在 this document .

我想我必须创建一个用户,例如 monitoring 然后让这个用户访问所有 virtual hosts 其中包含应监视的资源。

我认为在创建用户时,我必须将其分配给 标签 监测 这是一个预定义的标记。

我所做的 明白了,我需要分配给什么regex configure , write read . 这个 documentation 包含一个在上具有权限的表 资源 .

我认为监控软件应该 能够 创建或删除资源 ( 配置 许可)也不能 添加 发送到队列的消息或 读取和确认 来自队列的消息。但例如,它应该能够阅读 队列中等待通知队列中是否有大量未检索的增长消息的消息。

有人能解释一下,这样一个监控用户需要什么权限和设置吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/37840
 
662 次点击  
文章 [ 2 ]  |  最新文章 4 年前
laimison
Reply   •   1 楼
laimison    5 年前

以下是在设置rabbitmq队列监视时从头到尾的快速指南。

1)创建帐户:

rabbitmqctl add_user monitoring password

2)添加监控标签(您可以在此处阅读更多关于rabbitmq标签的信息 https://www.rabbitmq.com/management.html )

rabbitmqctl set_user_tags monitoring monitoring

3)现在获取虚拟主机的名称:

rabbitmqctl list_vhosts

4)向虚拟主机添加监控用户的权限:

rabbitmqctl set_permissions -p Some_Virtual_Host monitoring "" "" ""

5)检查是否成功授予访问权限:

curl -s -u monitoring:password http://localhost:15672/api/queues | jq

看看 "messages" 参数

可选)可以从命令行发布假消息:

rabbitmqadmin publish --vhost=Some_Virtual_Host exchange=some_exchange routing_key=outgoing_routing_key payload="hello world"

看看 “消息” 再一次!

提示:确保在rabbitmq构建中启用rabbitmq_管理插件,以便能够执行这些查询。

ThommyB
Reply   •   2 楼
ThommyB    5 年前

我自己做了一些测试。如果有人感兴趣:

创建帐户 monitoring 标签 将该帐户添加到应监视的每个vhost中,然后添加 空字符串 (“”)到 configure , write read 权限。

通过一个漂亮的bash脚本,您可以获得每个队列中的消息数:

curl -u username:password \
 --silent \
 http://<ServerOrIP>:15672/api/queues/<vhostname> | jq '.[] | .name, .messages'