191145685 发表于 2017-12-31 15:38:09

Zabbix 监控rabbitmq

  一 应用场景描述
  测试环境业务 OpenStack中搭建了rabbitmq作为RPC消息队列,所以mq起到了很重要的角色,本案例是来如何使用zabbix监控
  rabbitmq业务
  二 Rabbitmq监控要点
  RabbitMQ官方提供两种方法来管理和监控RabbitMQ。
  1.使用rabbitmqctl管理和监控
  查看虚拟主机
  # rabbitmqctl list_vhosts
  查看队列
  # rabbitmqctl list_queues
  查看exchanges
  # rabbitmqctl list_exchanges
  查看用户
  # rabbitmqctl list_users
  查看连接
  # rabbitmqctl list_connections
  查看消费者信息
  # rabbitmqctl list_consumers
  查看环境变量
  # rabbitmqctl environment
  查看未被确认的队列
  # rabbitmqctl list_queuesname messages_unacknowledged
  查看单个队列的内存使用
  # rabbitmqctl list_queues name memory
  查看准备就绪的队列
  # rabbitmqctl list_queues name messages_ready
  2.使用RabbitMQ Management插件来监控和管理
  开启Management插件
  # rabbitmq-plugins enable rabbitmq_management
  http://172.28.2.157:15672/
  通过这样的网址访问可以看到RabbitMQ的状态
  http://172.28.2.157:15672/cli/rabbitmqadmin
  下载rabbitmqadmin管理工具
  获取vhost列表
  # curl -i -u guest:guest http://localhost:15672/api/vhosts
  获取频道列表,限制显示格式
  # curl -i -u guest:guest "http://localhost:15672/api/channels?sort=message_stats.publish_details.rate&sort_reverse=true&columns=name,message_stats.publish_details.rate,message_stats.deliver_get_details.rate"
  显示概括信息
  # curl -i -u guest:guest "http://localhost:15672/api/overview"
  management_version管理插件版本
  cluster_name   整个RabbitMQ集群的名称,通过rabbitmqctl set_cluster_name 进行设置
  publish      发布的消息总数
  queue_totals   显示准备就绪的消息,未确认的消息,未提交的消息等
  statistics_db_event_queue    显示还未必数据库处理的事件数量
  consumers       消费者个数
  queues         队列长度
  exchanges       队列交换机的数量
  connections   连接数
  channels       频道数量
  显示节点信息
  # curl -i -u guest:guest "http://localhost:15672/api/nodes"
  disk_free   磁盘剩余空间,以字节表示
  disk_free_limit    磁盘报警的阀值
  fd_used    使用掉的文件描述符数量
  fd_total   可用的文件描述符数量
  io_read_avg_time      读操作平均时间,毫秒为单位
  io_read_bytes      总共读入磁盘数据大小,以字节为单位
  io_read_count      总共读操作的数量
  io_seek_avg_time      seek操作的平均时间,毫秒单位
  io_seek_count      seek操作总量
  io_sync_avg_time      fsync操作的平均时间,毫秒为单位
  io_sync_count      fsync操作的总量
  io_write_avg_time      每个磁盘写操作的平均时间,毫秒为单位
  io_write_bytes       写入磁盘数据总量,以字节为单位
  io_write_count       磁盘写操作总量
  mem_used         内存使用字节
  mem_limit          内存报警阀值,默认是总的物理内存的40%
  mnesia_disk_tx_count   需要写入到磁盘的Mnesia事务的数量
  mnesia_ram_tx_count    不需要写入到磁盘的Mnesia事务的数量
  msg_store_write_count写入到消息存储的消息数量
  msg_store_read_count   从消息存储读入的消息数量
  proc_used         Erlang进程的使用数量
  proc_total      Erlang进程的最大数量
  queue_index_journal_write_count    写入到队列索引日志的记录数量。每条记录表示一个被发布到队列,从消息队列中被投递出或者在消息队列中被q确认的消息
  queue_index_read_count   从队列索引读出的记录数量
  queue_index_write_count    写入到队列索引的记录数量
  sockets_used      以socket方式使用掉的文件描述符数量
  partitions
  uptime         自从Erlang VM启动时,运行的时间,单位好毫秒
  run_queue         等待运行的Erlang进程数量
  processors      检测到被Erlang进程使用到的内核数量
  net_ticktime       当前设置的内核tick time
  查看频道信息
  # curl -i -u guest:guest "http://localhost:15672/api/channels"
  查看交换机信息
  # curl -i -u guest:guest "http://localhost:15672/api/exchanges"
  查看队列信息
  # curl -i -u guest:guest "http://localhost:15672/api/queues"
  查看vhosts信息
  # curl -i -u guest:guest "http://localhost:15672/api/vhosts/?name=/"
页: [1]
查看完整版本: Zabbix 监控rabbitmq