warning prometheus alert for rabbitmq queue space left
Can you help me with Prometheus expression alert that can monitor the space left of a specific rabbitmq queue?
For example, I have couple of rabbitmq queues with “x-max-length-bytes”= 115747500 bytes”:
# rabbitmqctl -p v-host list_queues name arguments | grep 115747500
queue-test1 [{"x-max-length-bytes",115747500 }]
queue-test2 [{"x-dead-letter-exchange",[]},{"x-message-ttl",604800000},{"x-max-length-bytes",115747500 }]
queue-test3 [{"x-max-length-bytes",115747500 }]
queue-test4 [{"x-dead-letter-exchange",[]},{"x-message-ttl",604800000},{"x-max-length-bytes",115747500 }]
queue-test5 [{"x-max-length-bytes",115747500 }]
queue-test6 [{"x-dead-letter-exchange",[]},{"x-message-ttl",604800000},{"x-max-length-bytes",115747500 }]
# rabbitmqctl -p v-host list_queues
test1 471
test2 4163
test3 0
test4 2466
test5 0
test6 0
I found on the google that the max_message_size for Rabbitmq is 32768 bytes, so I thought if I can have the below math expression:
(max_message_size(32768 bytes) * number queue messages) - x-max-length-bytes ( 115747500 bytes) = total_space_left_in_queue_bytes
if total_space_left_in_queue_bytes > 90% = send warning
Read more here: Source link