title: Check if Rabbit MQ is down
body: <p>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.</p>
  
  <pre><code>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
          }
      }
  }
  </code></pre>
  
  <p>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#.</p>