old_contents: from flask import abort, Blueprint, jsonify
  
  from httpobs import SOURCE_URL, VERSION
  from httpobs.database import get_cursor
  
  
  monitoring_api = Blueprint('monitoring-api', __name__)
  
  
  @monitoring_api.route('/__heartbeat__')
  def heartbeat():
      # TODO: check celery/redis status
      try:
          with get_cursor() as _:  # noqa
              return ''
      except IOError:
          abort(500)
  
  
  @monitoring_api.route('/__lbheartbeat__')
  def lbheartbeat():
      return ''
  
  
  @monitoring_api.route('/__version__')
  def version():
      return jsonify({'source': SOURCE_URL,
                      'version': VERSION})
  
new_contents: from flask import abort, Blueprint, jsonify
  
  from httpobs import SOURCE_URL, VERSION
  from httpobs.conf import BROKER_URL
  from httpobs.database import get_cursor
  
  import kombu
  
  monitoring_api = Blueprint('monitoring-api', __name__)
  
  
  @monitoring_api.route('/__heartbeat__')
  def heartbeat():
      # TODO: check celery status
      try:
          # Check the database
          with get_cursor() as _:  # noqa
              pass
  
          # Check redis
          conn = kombu.Connection(BROKER_URL)
          conn.connect()
          conn.release()
  
      except:
          abort(500)
  
      return ''
  
  
  @monitoring_api.route('/__lbheartbeat__')
  def lbheartbeat():
      return ''
  
  
  @monitoring_api.route('/__version__')
  def version():
      return jsonify({'source': SOURCE_URL,
                      'version': VERSION})
  
subject: add monitoring for redis or rabbitmq