Complete the code to check the current depth of a RabbitMQ queue using the CLI.
rabbitmqctl list_queues -p / name messages_ready [1]The --vhost=/ option specifies the virtual host to query.
Complete the command to get consumer lag metrics from RabbitMQ management API using curl.
curl -u guest:guest http://localhost:15672/api/queues/[1]/myqueue
The API URL requires the virtual host name in the path to get queue details.
Fix the error in the Prometheus alert rule to trigger when queue depth exceeds 1000.
alert: HighQueueDepth expr: rabbitmq_queue_messages_ready > [1] for: 5m labels: severity: warning annotations: summary: "Queue depth is high"
The expression expects a numeric value without quotes or units. Using 1000 is correct.
Fill both blanks to create a Prometheus alert that triggers when consumer lag is above 500 for 10 minutes.
alert: HighConsumerLag expr: rabbitmq_consumer_lag [1] [2] for: 10m labels: severity: critical annotations: summary: "Consumer lag is too high"
The alert triggers when the consumer lag metric is greater than 500.
Fill all three blanks to define a Prometheus alert that fires when queue depth is above 1000 and consumer lag is above 200.
alert: QueueDepthAndLagHigh expr: rabbitmq_queue_messages_ready [1] [2] and rabbitmq_consumer_lag [3] 200 for: 5m labels: severity: critical annotations: summary: "Queue depth and consumer lag are high"
The alert expression checks if queue depth is greater than 1000 and consumer lag is greater than 200.