Created
May 8, 2020 04:04
-
-
Save johanrhodin/0611a777f217b3c50a6a44e9a0c9b28b to your computer and use it in GitHub Desktop.
Count vhosts that has started
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
bash << EOF | |
logpath=("/var/log/rabbitmq/rabbit@HOSTNAME.log") | |
numbervhosts=$(expr $(sudo rabbitmqctl list_vhosts | wc -l) - $num) | |
startnr=$(grep -n "Starting RabbitMQ" $logpath | tail -1 | cut -d : -f 1) # Last RabbitMQ Starting | |
startedvhosts=$(sed -n "$startnr"',$p' $logpath | grep -n "Starting message stores for vhost" | wc -l) | |
awk -v nvh="$numbervhosts" -v svh="$startedvhosts" 'BEGIN{ print int(svh/nvh*100) }' | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment