Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active April 26, 2022 04:22
Show Gist options
  • Save hoangdh/c86dc9d081882ac116322b45399f0442 to your computer and use it in GitHub Desktop.
Save hoangdh/c86dc9d081882ac116322b45399f0442 to your computer and use it in GitHub Desktop.
Set Ngưỡng cảnh báo cho RabbitMQ

Một vài ghi chép về set ngưỡng cho plugin giám sát RabbitMQ

Trước khi thực hiện, vui lòng tham khảo những bài viết sau:

1. Giám sát Aliveness, trạng thái của v.host

./check_rabbitmq_aliveness -H node1 -u mon -p 1 --vhost / 

RABBITMQ_ALIVENESS OK - vhost: /
  • Giải thích:
    • /: V.Host cần giám sát. Chú ý: user phải được phân quyền trên V.Host này.

2. Giám sát Cluster

./check_rabbitmq_cluster -H node1 -u mon -p 1 -w @1:2 -c @0:1


RABBITMQ_CLUSTER OK - nb_running_node OK (3) nb_running_disc_node OK (3) nb_running_ram_node OK (0)
  • Giải thích:
    • @1:2: Trong khoảng từ 1-2 host bị còn sống, sẽ cảnh báo Warning.
    • @0:1: 1 host duy nhất còn sống sẽ cảnh báo Critical.

3. Giám sát Connections: Connections, Connections_notRunning, Receive_rate, Send_rate

./check_rabbitmq_connections -H node1 -u mon -p 1

RABBITMQ_CONNECTIONS OK - connections OK (0) connections_notrunning OK (0) receive_rate OK (0) send_rate OK (0) | connections=0;; connections_notrunning=0;; receive_rate=0;; send_rate=0;;
  • NOTE:
    • 2 thông số connections_* tính theo đơn vị bình thường (1k, 2k, ...)
    • 2 thông số *_rate tính theo đơn vị b/s

4. Giám sát Exchange:

./check_rabbitmq_exchange -H node1 -u mon -p 1 --exchange amq.fanout --period 3 --vhost /

RABBITMQ_EXCHANGE OK - confirm_avg_rate OK (0.000000) publish_in_avg_rate OK (0.000000) publish_out_avg_rate OK (0.000000) | confirm_avg_rate=0;; publish_in_avg_rate=0;; publish_out_avg_rate=0;;
  • NOTE:
    • --exchange: Tên Exchange muốn giám sát
    • --period: Đơn vị ms. Cần xác minh.

5. Kiểm tra Object: Số lượng V.Host, Exchange, Binding, Queue, Channel

./check_rabbitmq_objects -H node1 -u mon -p 1

RABBITMQ_OBJECTS OK - Gathered Object Counts | vhost=1;; exchange=14;; binding=2;; queue=2;; channel=0;;
  • NOTE:
    • Không đặt được ngưỡng

6. Kiểm tra số lượng messages: Messages, Messages_ready, Messages_unacknowleged

./check_rabbitmq_overview -H node1 -u mon -p 1

RABBITMQ_OVERVIEW OK - messages OK (0) messages_ready OK (0) messages_unacknowledged OK (0) | messages=0;; messages_ready=0;; messages_unacknowledged=0;;
  • NOTE:
    • Đặt ngưỡng theo số lượng messages.

7. Kiểm tra tình trạng Partitions:

./check_rabbitmq_partition -H node1 -u mon -p 1

RABBITMQ_PARTITION OK - No Partitions

8. Giám sát các queue:

./check_rabbitmq_queue -H node1 -u mon -p 1


RABBITMQ_QUEUE OK - All queues under the thresholds | messages=0.0000;; messages_ready=0.0000;; messages_unacknowledged=0.0000;; consumers=0.0000;;
  • NOTE:
    • --critical=100,90,20,10: Có hơn 100 msg, nhiều hơn 90 msgs_ready, hơn 20 msgs_unack và có dưới 10 consumer đang hoạt động.
    • Giải thích bên trong plugin:
    Use the management interface of RabbitMQ to count the number of pending,
    ready and unacknowledged messages and number of consumers.  These are
    published as performance metrics for the check.
    
    Critical and warning thresholds can be set for each of the metrics.
    
    It uses Monitoring::Plugin and accepts all standard Nagios options.
    

9. Giám sát trạng thái Server Standalone: RAM, FD, Processes, Sockets

./check_rabbitmq_server -H node1 -u mon -p 1 -w 80,80,80,80 -c 85,85,85,85
  • NOTE:
    • Chưa rõ thông số FD (file descriptor).
    • Ngưỡng cảnh báo được theo đơn vị %
    • Các thông số lần lượt được sắp xếp theo thứ tự: RAM, File Descriptor, Processes, Sockets
    • Giải thích trong plugin:
    **Use the management interface of RabbitMQ to check the resource usage of the
    server.  This check looks at the node statistics for the rabbit node on
    the host and examines the erlang memory, process and file descriptor usage.
    It provides performance data for each of these variables and allows for
    warning and criticality levels to be specified for each.
    It uses Monitoring::Plugin and accepts all standard Nagios options.
    

10. RabbitMQ Shovels

./check_rabbitmq_shovels -H node1
RABBITMQ_SHOVELS CRITICAL - API error: 404 Object Not Found
  • NOTE:
    • Chưa rõ thông tin về Shovels.
    • Giải thích trong plugin:
    This program is a Nagios plugin that uses the JSON over HTTP API to check that all shovels of the given RabbitMQ host are running.
    The default settings match the standard installation of RabbitMQ. The check returns C<OK> if all shovels are running,
    C<WARNING> if one or more shovels are blocked, C<CRITICAL> if one or more shovels are terminated.
    

11. RabbitMQ Watermark

./check_rabbitmq_watermark -H node3 -u mon -p 1 --vhost /

RABBITMQ_WATERMARK OK - mem_alarm disk_free_alarm
  • NOTE:
    • Chưa rõ thông tin về Watermark.
    • Giải thích trong plugin:
    Use the management interface of RabbitMQ to check if the mem_alarm or disk_free_alarm has been triggered.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment