Q:

Check if Rabbit MQ is down

I am writing a C# Console app (Windows scheduled task) to monitor the status of Rabbit MQ.  So in case the the queue is down (service down, connection timeout, or any other reason) it will send a notification mail.  I have used RabbitMQ .Net client (version 4.1.1).  Basically I am checking if the CreateConnection() is successfull. 
private static void CheckRabbitMQStatus()
{
    ConnectionFactory factory = new ConnectionFactory();
    factory. Uri = "amqp://guest:guest@testserver:5672/";
    IConnection conn = null;
    try
    {
        conn = factory. CreateConnection();
        conn. Close();
        conn. Dispose();
    }
    catch (Exception ex)
    {
        if (ex. Message == "None of the specified endpoints were reachable")
        {
            //send mail MQ is down
        }
    }
}

Is this the right approach to achieve this?  There are several tools and plugins available for Rabbit MQ but I want a simple solution in C#. 

A:

It should work, if you have a simple message queue setup (without clustering or federation of multiple machines). 
The RabbitMQ API has an aliveness check, designed for use by monitoring tools such as yours.  It actually sends and receives a message.  This is likely to be a more sensitive health check than yours.   See the last item on here.  
http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v2_2_0/priv/www-api/help.html
RabbitMQ itself is robust.  Usually the failure mode it experiences is its host being rebooted for other reasons. 
Note: There's a nice DebuggableService template by Rob Three in the Windows Marketplace.  This makes it pretty easy to rig your health check as a service rather than as a scheduled task.   My life got easier when I refactored my MQ stuff to run as services rather than scheduled tasks.