Trước khi thực hiện, vui lòng tham khảo những bài viết sau:
-
Link bài chi tiết về ngưỡng: https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT
-
Link tải plugin: https://github.com/nagios-plugins-rabbitmq/nagios-plugins-rabbitmq
-
Link hướng dẫn cài đặt: https://github.com/hoangdh/meditech-ghichep-nagios/blob/master/docs/thuchanh-nagios/5.Monitor-RabbitMQ.md
-
Chú thích
-H
: Hostname của RabbitMQ, trùng với tên hostname khai báo trên cluster RabbitMQ. Có thể sử dụng FQDN hoặc ghi vào file/etc/hosts
của máy OMD.-u
: User có quyền monitoring-p
: Password của User-w
: Ngưỡng cảnh báo Warning.-c
: Ngưỡng cảnh báo Cirtical.- Không đặt ngưỡng cảnh báo, chọn giá trị ngưỡng là
-1
./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.
./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.
./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
- 2 thông số
./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.
./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
./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.
./check_rabbitmq_partition -H node1 -u mon -p 1
RABBITMQ_PARTITION OK - No Partitions
./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.
./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.
./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.
./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.