rabbitmq的四种集群监控方式:
第一种、使用控制台页面监控rabbitmq
网址:http://mq服务ip:15672 登录,可以根据不同菜单中对各项信息进行查看。
第二种、通过tracing日志查看消息的发送流程
参阅文章:消息的追踪查看配置及查看方法 ,通过log文件信息查看消息的发送、接收时间。
第三种、通过restful api接口自定义监控实现
登录控制台地址后,访问地址 http://172.18.255.118:15672/api/index.html ,ip为服务器地址,可以看到api文档相关介绍。通过api接口我们可以实现自己的监控内容以及界面。
eg:登录后请求地址 http://172.18.255.118:15672/api/connections 返回信息如下:
[{"auth_mechanism":"PLAIN","channel_max":2047,"channels":0,"client_properties":{"capabilities":{"authentication_failure_close":true,"basic.nack":true,"connection.blocked":true,"consumer_cancel_notify":true,"exchange_exchange_bindings":true,"publisher_confirms":true},"copyright":"Copyright (c) 2007-2019 Pivotal Software, Inc.","information":"Licensed under the MPL. See http://www.rabbitmq.com/","platform":"Java","product":"RabbitMQ","version":"5.6.0"},"connected_at":1595647363915,"frame_max":131072,"garbage_collection":{"fullsweep_after":65535,"max_heap_size":0,"min_bin_vheap_size":46422,"min_heap_size":233,"minor_gcs":4},"host":"172.18.255.118","name":"172.18.255.162:52348 -> 172.18.255.118:5672","node":"rabbit-1@localhost","peer_cert_issuer":null,"peer_cert_subject":null,"peer_cert_validity":null,"peer_host":"172.18.255.162","peer_port":52348,"port":5672,"protocol":"AMQP 0-9-1","recv_cnt":3,"recv_oct":620,"recv_oct_details":{"rate":36.0},"reductions":8905,"reductions_details":{"rate":628.2},"send_cnt":3,"send_oct":651,"send_oct_details":{"rate":23.8},"send_pend":0,"ssl":false,"ssl_cipher":null,"ssl_hash":null,"ssl_key_exchange":null,"ssl_protocol":null,"state":"running","timeout":60,"type":"network","user":"xiaohui","user_who_performed_action":"xiaohui","vhost":"/myhost"},{"client_properties":{},"connected_at":1595645109548,"name":"","node":"rabbit-1@localhost","protocol":"Direct 0-9-1","type":"direct","user":"guest","user_who_performed_action":"guest","vhost":"/myhost"},{"client_properties":{},"connected_at":1595645512615,"name":"","node":"rabbit-1@localhost","protocol":"Direct 0-9-1","type":"direct","user":"xiaohui","user_who_performed_action":"xiaohui","vhost":"/myhost"}]
第四种、通过Zabbix监控rabbitmq(内容过多,这里不做介绍)