Created
November 21, 2018 20:34
-
-
Save scottillogical/7770886dd09cfbdefb0ac63b39501af0 to your computer and use it in GitHub Desktop.
detect rabbitmq missing bindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$RMQ_USERNAME" ]; then | |
echo "Error:RMQ_USERNAME was not set." | |
exit 1 | |
fi | |
if [ -z "$RMQ_PASSWORD" ]; then | |
echo "Error:RMQ_PASSWORD was not set." | |
exit 1 | |
fi | |
if [ -z "$RMQ_IP" ]; then | |
echo "Error:RMQ_IP was not set." | |
exit 1 | |
fi | |
set -e | |
baseUrl="http://$RMQ_IP:15672/api" | |
for vhostqueue in $(curl --fail -q --header "Accept: application/json" -u $RMQ_USERNAME:$RMQ_PASSWORD "$baseUrl/queues" | jq -r '.[] | .vhost + "/" + .name' ); do | |
curl --fail --header "Accept: application/json" -s -u $RMQ_USERNAME:$RMQ_PASSWORD "$baseUrl/queues/${vhostqueue}/bindings" | jq '.' | jq --arg vhostqueue $vhostqueue 'select(length <= 0) | $vhostqueue,.' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment