[rabbitmq-discuss] API aliveness test

Simon MacMullen simon at rabbitmq.com
Fri Aug 12 10:48:38 BST 2011

On 11/08/11 21:43, Jason J. W. Williams wrote:
> Hi,
> The documentation for the API aliveness-test call
> (/api/aliveness-test/<vhost>) defines the success result
> ({"status":"ok"}), but not the failure results. When I use
> "rabbitmqctl stop_app" to simulate a failure, I get fairly ugly
> traceback returned over HTTP (https://gist.github.com/1140707) that'll
> crash the JSON parser. So should I just do a string match for
> {"status": "ok"} (or HTTP error code match) and consider any other
> return a failure, or are there JSON-friendly error outputs as well?

No, no JSON-friendly error outputs. The reason being that you always 
have to allow for the possibility that *something* might go wrong that 
would prevent it from outputting properly formatted JSON. Or replying at 

So for monitoring with this, I would just do the string match, and also 
have a timeout for whether it replies at all.

Actually, you could ignore the body and just check the HTTP status code, 
it won't return 200 OK unless things are good.

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list