Refactor a bit the code for the rabbitmq check